Insert CSS insert after 4th child

This example currently shows an unordered list with 8 list items in it.

Is there a way to use only CSS (without HTML or JavaScript) to insert a gap after the 4th li element. Something like:

 ul li:nth-child(4n):after { content = '<br>'; } 
+8
dom html css html-lists
source share
2 answers

Add a block element after it: http://jsfiddle.net/M4aV3/1/

 ul li:nth-child(4n):after { content: ' '; display: block; } 
+15
source share

You can also use the interrupt character:

 li:nth-child(4n):after { content: '\a'; white-space: pre; } 

http://jsfiddle.net/00woyu28/

+4
source share

All Articles