Reputation: 14239
Currently, this example shows an unordered list with 8 list items in it.
Is there a way using only CSS (no HTML or JavaScript) to insert a break after the 4th li
item. Something like:
ul li:nth-child(4n):after {
content = '<br>';
}
Upvotes: 8
Views: 8619
Reputation: 255
You can also use a break character:
li:nth-child(4n):after {
content: '\a';
white-space: pre;
}
Upvotes: 4
Reputation: 349132
Add a block-element after it: http://jsfiddle.net/M4aV3/1/
ul li:nth-child(4n):after {
content: ' ';
display: block;
}
Upvotes: 15