Is there a way to create a responsive layout with CSS that automatically adds a divider after a certain number of elements?
For example, I have a set of elements with the class .beers
, and I want to insert a .divider
element after every 5th .beers
element in my layout.
You can check out an example of what I'm trying to achieve in this FIDDLE
If anyone has any ideas on how to accomplish this, I would greatly appreciate the help.
Thank you!
Here is the CSS I am currently using:
.wrapper{
width:100%;
}
.content{
width:960px;
height:500px;
}
.beers{
position: relative;
width: 166px;
display:inline-block;
margin-right: 5px;
height: 107px;
margin-bottom: 20px;
padding-left: 10px;
padding-right: 10px;
text-decoration: none;
border: 1px dotted #e46a10;
}
.divider{
display: block;
border-bottom: 1px dotted #ccc;
margin-bottom: 20px;
}