I recently got help on an issue I got and the final code is in the code section. Now I have just recognized that for smartphone view it does not look the way I want it. The current format is as follows:
Image | Text
Text | Image
Image | Text
Text | Image
For mobile view it should be:
Image
Text
Image
Text
Image
Text
Image
Text
The format for the second and fourth row have to be changed for the mobile view, in order to have the order image - text - image - text etc. For mobile view I have this section: #media only screen and (max-width: 768px){}. Also, does it make sense to have a separate class for each row? Can you please help?
.h1 {
display: flex;
align-items: center;
justify-content: center;
font-size: 50px;
padding-bottom: 50px;
}
.text {
font-size: 24px;
flex-direction: column;
}
.desc {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.image,
.text {
display: flex;
flex: 1 1 50%;
align-items: center;
justify-content: center;
padding: 10px 10px 20px 10px;
box-sizing: border-box;
flex-direction: column;
border: 2px solid;
}
.image img {
max-width: 80%;
}
.left {
justify-content: flex-start;
}
.right {
justify-content: flex-end;
}
<div class="h1">Headline</div>
<div class="desc">
<div class="image left">
<img src="https://homepages.cae.wisc.edu/~ece533/images/mountain.png">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="image right">
<img src="https://homepages.cae.wisc.edu/~ece533/images/mountain.png">
</div>
<div class="image left">
<img src="https://homepages.cae.wisc.edu/~ece533/images/mountain.png">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="image right">
<img src="https://homepages.cae.wisc.edu/~ece533/images/mountain.png">
</div>
</div>
You can achieve this by updating your CSS
#media only screen and (max-width: 768px){
.desc {
flex-direction: column;
}
.desc > div:first-of-type{
order: 1;
}
.desc > div:nth-last-of-type(2){
order: 2;
}
.desc > div:nth-last-of-type(3){
order: 4;
}
.desc > div:nth-last-of-type(4){
order: 3;
}
.desc > div:nth-last-of-type(5){
order: 5;
}
.desc > div:nth-last-of-type(6){
order: 6;
}
.desc > div:nth-last-of-type(7){
order: 8;
}
.desc > div:nth-last-of-type(8){
order: 7;
}
}
and don't forget to add a viewport in your HTML head if you want the media query to work on mobile devices :
<meta name="viewport" content="width=device-width, initial-scale=1">
Think mobile first and update your html code:
.desc {
display: grid;
}
#media (min-width:768px) {
.desc {
grid-template-columns:1fr 1fr; /* 2 columns only on big screen */
grid-auto-flow:dense; /* fill all the area */
}
.image:nth-child(4n + 3) {
grid-column:2; /* move the each second image to the second column */
}
}
.image,
.text {
display: flex;
align-items: center;
justify-content: center;
padding: 10px 10px 20px 10px;
box-sizing: border-box;
flex-direction: column;
border: 2px solid;
}
.image img {
max-width: 80%;
}
<div class="desc">
<div class="image">
<img src="https://picsum.photos/id/237/200/300">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="image ">
<img src="https://picsum.photos/id/237/200/300">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="image">
<img src="https://picsum.photos/id/237/200/300">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
<div class="image">
<img src="https://picsum.photos/id/237/200/300">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
</div>
If you are able to restructure your code into groupings as follows:
<div class="content-block">
<div class="image">
<img src="https://homepages.cae.wisc.edu/~ece533/images/mountain.png">
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
</div>
then you could rewrite the css for your markup in a more compact way that would prevent the need for adding more :nth-of-type statements to your css every time you added a new piece of text or an image.
This css could be written as follows and would account for both mobile and larger breakpoints:
.content-block {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: 16px;
}
.image,
.text {
display: flex;
flex: 1 1 50%;
align-items: center;
justify-content: center;
padding: 10px 10px 20px 10px;
box-sizing: border-box;
flex-direction: column;
border: 2px solid;
}
.image img {
max-width: 80%;
}
.content-block:nth-of-type(even) .image {
order: 2;
}
#media only screen and (max-width: 768px) {
.content-block {
flex-direction: column;
}
.content-block .image {
order: 1;
}
.content-block .text {
order: 2;
}
}
/* Styles from here and downward can be ignored - they are just for clarity of the example using colours/spacings */
.content-block {
background: aliceblue;
color: black;
}
<div class="desc">
<div class="content-block">
<div class="image left">
Image here
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
</div>
<div class="content-block">
<div class="image left">
Image here
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
</div>
<div class="content-block">
<div class="image left">
Image here
</div>
<div class="text">
<b>Text</b>
<p>Text</p>
</div>
</div>
</div>
Related
Right now I'm trying to make elements wrap based on the size of the screen but instead of wrapping only when there is no space to fit each element and its desired width that I hardcoded, I want it to wrap when there is a certain gap between each of the objects.
I outlined it so its easier to see but this is what it normally looks like:
And once I resize the screen to a point where it's still not wrapping this is what it looks like:
How do I make it so that it starts wraping once the gap between all the items inside the big box is around this size:
Here is my HTML code:
<div class="profiles-sec">
<div className="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" className="profile-img"></img>
<h3 className="user-name">t</h3>
<h5>Founder</h5>
<p>Description</p>
</div>
<div className="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" className="profile-img"></img>
<h3 className="user-name">t</h3>
<h5>Founder</h5>
<p>Description</p>
</div>
<div className="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" className="profile-img"></img>
<h3 className="user-name">t</h3>
<h5>Co-Founder</h5>
<p>Description</p>
</div>
<div className="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" className="profile-img"></img>
<h3 className="user-name">t</h3>
<h5>Co-Founder</h5>
<p>Description</p>
</div>
</div>
Here is my CSS code:
.profiles-sec {
display: flex;
justify-content: space-around;
margin: 80px 80px;
border: solid 1px black;
flex-wrap: wrap;
}
.profile {
flex-basis: 400;
border: solid 1px black;
}
#media only screen and (max-width: 1500px) {
.profile {
display: flex;
flex-direction: column;
align-items: center;
}
.profile p {
text-align: center;
margin: 20px 60px 80px 60px;
font-size: 20px;
}
}
You can use flexbox's gap property to have flex-wrap break at the value that you define. In this example, I have set the gap value to 30px. This allows the profiles to break to a new line once there is exactly 30px between the profiles.
.profiles-sec {
display: flex;
gap: 30px;
justify-content: space-around;
margin: 80px 80px;
border: solid 1px black;
flex-wrap: wrap;
}
.profile {
flex-basis: 400px;
border: solid 1px black;
}
.profile img {
width: 100%;
}
#media only screen and (max-width: 1500px) {
.profile {
display: flex;
flex-direction: column;
align-items: center;
}
.profile p {
text-align: center;
margin: 20px 60px 80px 60px;
font-size: 20px;
}
}
<div class="profiles-sec">
<div class="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" className="profile-img"></img>
<h3 class="user-name">t</h3>
<h5>Founder</h5>
<p>Description</p>
</div>
<div class="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" class="profile-img"></img>
<h3 class="user-name">t</h3>
<h5>Founder</h5>
<p>Description</p>
</div>
<div class="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" class="profile-img"></img>
<h3 class="user-name">t</h3>
<h5>Co-Founder</h5>
<p>Description</p>
</div>
<div class="profile">
<img src="https://images.pexels.com/photos/220453/pexels-photo-220453.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" class="profile-img"></img>
<h3 class="user-name">t</h3>
<h5>Co-Founder</h5>
<p>Description</p>
</div>
</div>
I am trying to create flexbox with different image heights and width. I want the break points as
max-width: 640px; ------->Only one column
max-width: 860px; -------->Two columns only
greater than: 860px;-------->Three column only
What I am messing with? Why it is becoming ugly while shrinking window?I am losing 3 column of image even before window size reach 860px breakpoint. What else can I do?
After window size reaches to 860px it is working fine, but until than it is becoming ugly.
I want my image height not be changed. Let it be as it is !
.container {
width: 100%;
height: 1000px;
display: flex;
flex-direction: column;
background: green;
flex-wrap: wrap;
align-items: center;
align-content: center;
justify-content: flex-start;
}
.box {
width: 30%;
border: 2px solid red;
margin: 8px;
}
img {
width: 100%;
height: auto;
}
#media screen and (max-width: 860px) {
.container {
background-color: red;
height: 1100px;
}
.box {
width: 46%;
}
}
#media screen and (max-width: 640px){
.container {
background-color: yellowgreen;
height: auto;
flex-direction: row;
}
.box {
width: 100%;
}
}
<div class="container">
<div class="box">
<img src="https://www.daily-sun.com/assets/news_images/2017/01/12/DAILYSUN_ZYAN.jpg" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/79/e2/8d/79e28db17abc2eb6c3085c9c72bff5e4.jpg" alt="">
</div>
<div class="box">
<img src="https://www.pinkvilla.com/files/styles/gallery-section/public/zayn_malik_tattoos_1.jpg?itok=Q5bXGlfm" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/b5/0c/30/b50c30ddaaffc98ff2cb077cc7f57823.jpg" alt="">
</div>
<div class="box">
<img src="https://images.news18.com/ibnlive/uploads/2021/01/1610783227_zayn-malik.jpg" alt="">
</div>
<div class="box">
<img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/gigi-hadid-and-zayn-malik-attend-the-manus-x-machina-news-photo-527409630-1554477973.jpg?crop=1.00xw:0.762xh;0,0.0194xh&resize=480:*" alt="">
</div>
</div>
In this cas, I would use CSS column-count and CSS grid.
Just an example with your code:
.container {
column-count: 3;
column-gap: 10px;
background: green;
padding: 10px;
}
#media (max-width: 640px) {
.container {
column-count: 1;
}
}
#media (min-width: 641px) and (max-width: 840px) {
.container {
column-count: 2;
}
}
img {
max-width: 100%;
display: block;
}
.box {
margin: 0;
display: grid;
grid-template-rows: 1fr auto;
margin-bottom: 10px;
break-inside: avoid;
border: 2px solid red;
}
<div class="container">
<div class="box">
<img src="https://www.daily-sun.com/assets/news_images/2017/01/12/DAILYSUN_ZYAN.jpg" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/79/e2/8d/79e28db17abc2eb6c3085c9c72bff5e4.jpg" alt="">
</div>
<div class="box">
<img src="https://www.pinkvilla.com/files/styles/gallery-section/public/zayn_malik_tattoos_1.jpg?itok=Q5bXGlfm" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/b5/0c/30/b50c30ddaaffc98ff2cb077cc7f57823.jpg" alt="">
</div>
<div class="box">
<img src="https://images.news18.com/ibnlive/uploads/2021/01/1610783227_zayn-malik.jpg" alt="">
</div>
<div class="box">
<img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/gigi-hadid-and-zayn-malik-attend-the-manus-x-machina-news-photo-527409630-1554477973.jpg?crop=1.00xw:0.762xh;0,0.0194xh&resize=480:*" alt="">
</div>
</div>
However for this layout using grid is the best way, but I tried to find a way by flex. For "flex-direction: column;" height is important so you should set a height that can't contain more than 2 images. I did it with "height: 70vw;"
.container {
width: 100%;
height: 70vw;
display: flex;
flex-direction: column;
background: green;
flex-wrap: wrap;
align-items: center;
align-content: center;
justify-content: flex-start;
}
.box {
width: 30%;
border: 2px solid red;
margin: 8px;
}
img {
width: 100%;
height: auto;
}
#media screen and (max-width: 860px) {
.container {
background-color: red;
height: 1120px;
}
.box {
width: 46%;
}
}
#media screen and (max-width: 640px){
.container {
background-color: yellowgreen;
height: auto;
flex-direction: row;
}
.box {
width: 100%;
}
}
<div class="container">
<div class="box">
<img src="https://www.daily-sun.com/assets/news_images/2017/01/12/DAILYSUN_ZYAN.jpg" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/79/e2/8d/79e28db17abc2eb6c3085c9c72bff5e4.jpg" alt="">
</div>
<div class="box">
<img src="https://www.pinkvilla.com/files/styles/gallery-section/public/zayn_malik_tattoos_1.jpg?itok=Q5bXGlfm" alt="">
</div>
<div class="box">
<img src="https://i.pinimg.com/originals/b5/0c/30/b50c30ddaaffc98ff2cb077cc7f57823.jpg" alt="">
</div>
<div class="box">
<img src="https://images.news18.com/ibnlive/uploads/2021/01/1610783227_zayn-malik.jpg" alt="">
</div>
<div class="box">
<img src="https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/gigi-hadid-and-zayn-malik-attend-the-manus-x-machina-news-photo-527409630-1554477973.jpg?crop=1.00xw:0.762xh;0,0.0194xh&resize=480:*" alt="">
</div>
</div>
When I often visit websites of companies I saw that common pattern where there is an image on the left side and the description the right side, as I scroll down the second column is the opposite, the image is on the right side and the text on the left side, and so on.
I tried creating something simimlar with flexbox:
:root {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 0;
}
h2 {
color: #5c3b65;
font-size: 2.1rem;
}
.about-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
.about-container > * {
width: 100%;
}
.row {
display: flex;
flex-wrap: wrap;
border: 1px solid green;
margin: 20px 0 50px;
}
#media (min-width: 52em) {
[class*="col-"] {
border: 1px solid orange;
}
.col-1 {
flex: 25%;
}
.col-2 {
flex: 50%;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="images-oddeven.css">
<title>Odd and Even</title>
</head>
<body>
<section class="about">
<div class="about-container">
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
<div class="row">
<div class="col-1">
<h2>Title</h2>
<p>Text</p>
</div>
<div class="col-2">
<img src="https://picsum.photos/400" alt="">
</div>
</div>
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
</div>
</section>
</body>
</html>
However I'm sure my code doesn't work properly because I want that 25% width for images but the position of images change. So, sometimes I need that 25% column width on the left side, sometimes on the right side.
Do you think would it be easier to approach this with CSS Grid? Browser compatibility is not an issue to me. I don't need support for IE11.
Keep the same html for all rows and change the order of col-1 in even rows.
.row:nth-child(2n) .col-1 {
order: 2;
}
:root {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 0;
}
h2 {
color: #5c3b65;
font-size: 2.1rem;
}
.about-container {
max-width: 1200px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
.about-container>* {
width: 100%;
}
.row {
display: flex;
flex-wrap: wrap;
border: 1px solid green;
margin: 20px 0 50px;
}
#media (min-width: 52em) {
[class*="col-"] {
border: 1px solid orange;
}
.col-1 {
flex: 25%;
}
.col-2 {
flex: 50%;
}
.row:nth-child(2n) .col-1 {
order: 2;
}
}
<section class="about">
<div class="about-container">
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
</div>
</section>
If you want to use grid, you can try like below
:root {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
margin: 0;
padding: 0;
}
.about-container {
max-width: 1200px;
margin: 0 auto;
padding: 10px;
}
.row {
display: grid;
grid-template-columns: 25% 1fr; /* or use 50% instad of 1fr */
margin: 0 0 50px;
}
img {
max-width: 100%;
}
.row:nth-child(2n) {
grid-template-columns: 1fr 25%;
}
.row:nth-child(2n) .col-2 {
grid-area: 1;
}
<section class="about">
<div class="about-container">
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
<div class="row">
<div class="col-1">
<img src="https://picsum.photos/400" alt="">
</div>
<div class="col-2">
<h2>Title</h2>
<p>Text</p>
</div>
</div>
</div>
<!-- / .about-container -->
</section>
<!-- / .about -->
I like to use display: flex; if you put two divs into one that has display flex and give them width 50% it should work.
Also, you can do orders in flex.
Here is a useful article
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
I don't currently have a snippet that I can show but the article includes a few ways to do what you want.
I have this mockup, there are some nested containers. some of the link-class have multiple elements (par and ref) and I want them to display next to each other if there's space, but responsively move them below each other when total width gets smaller.
It works somewhat, but I expect (want) the link-element containing two childs to return to the same width as the link-element with one single child as it wraps.
For some reason, it remains wider than the single-child ones.
Any hints appreciated!
Code:
let name = 'world';
:global(body) {
margin: 0;
padding: 0
}
.main {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
background-color: gray;
}
.Container {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: lightblue;
padding: 3px
}
.linkContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3px;
background-color: salmon;
}
.par {
width: 80vw;
max-width: 300px;
background-color: red
}
.links {
display: flex;
flex-flow: row wrap;
padding: 3px;
background-color: orange
}
.ref {
background-color: olive;
width: 30vw;
max-width: 100px
}
.item {
width: 80vw;
max-width: 300px;
background-color: steelblue
}
<div class="main">
<div class="Container">
<div class="item">
header
</div>
<div class="linkContainer">
<div class="links">
<div class="par">
some text
</div>
</div>
<div class="links">
<div class="par">
some text
</div>
</div>
<div class="links">
<div class="par">
some text
</div>
</div>
<div class="Container">
<div class="item">
another header
</div>
<div class="linkContainer">
<div class="links">
<div class="par">
some text
</div>
<div class="ref">
a ref
</div>
</div>
<div class="links">
<div class="par">
some text
</div>
</div>
<div class="links">
<div class="par">
some text
</div>
<div class="ref">
a ref
</div>
</div>
</div>
</div>
</div>
</div>
</div>
you could simply add a max-width:300px; to .links and have the box in size but then you couldn't have the desired stacking effect you wanted so i went a bit further and with the help of css variables and media queries and adding a class .single to single .pars which didn't have a .ref after them, i came up with this:
:root {
--ref-size: 100px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.main {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
background-color: gray;
}
.Container {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: lightblue;
padding: 3px
}
.links {
min-width: 300px;
display: flex;
flex-flow: row wrap;
padding: 3px;
background-color: orange;
}
.par {
width: calc(100% - var(--ref-size));
background-color: red;
}
.ref {
background-color: olive;
width: var(--ref-size);
}
.item {
width: 80vw;
max-width: 300px;
background-color: steelblue
}
#media all and (max-width:300px){
.par{
width: 100%;
}
}
#media all and (min-width: 300px){
.par.single{
width: 100%;
}
}
<div class="main">
<div class="Container">
<div class="item links">
header
</div>
<div class="links">
<div class="par single">
some text
</div>
</div>
<div class="links">
<div class="par single">
some text
</div>
</div>
<div class="links">
<div class="par single">
some text
</div>
</div>
<div class="item links">
another header
</div>
<div class="links">
<div class="par">
some text
</div>
<div class="ref">
a ref
</div>
</div>
<div class="links">
<div class="par single">
some text
</div>
</div>
<div class="links">
<div class="par">
some text
</div>
<div class="ref">
a ref
</div>
</div>
</div>
</div>
How can I create a “Show All” button after the first image in the gallery on mobile - 600px<, and have a scrollable fixed-width block (div) everywhere else?
It seems, that the only way to do it without js is to have either one or the other - either "Show more" button, or a fixed-width scrollable section.
.container {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto;
max-width: 1200px;
padding: 0 1rem;
}
.book {
max-width: 100%;
}
.cell img {
display: block;
}
#media screen and (min-width: 600px) {
.container{
overflow: auto;
height: calc(70vh);
}
.grid {
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.cell {
width: calc(50% - 2rem);
}
}
#media screen and (min-width: 1000px) {
.container{
overflow: auto;
max-height: 80vh;
}
.cell {
width: calc(33.3333% - 2rem);
}
}
.cell {
margin: 1rem;
}
<div class="container" id="books">
<div class="container">
<div class="grid">
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
<div class="cell">
<img src="http://lorempixel.com/200/300" class="book">
</div>
</div>
</div>
</div>