CSS to line break before/after a particular `inline-block` item
I've been able to make it work on inline LI elements. Unfortunately, it does not work if the LI elements are inline-block:
Live demo: http://jsfiddle.net/dWkdp/
Or the cliff notes version:
li {
display: inline;
}
li:nth-child(3):after {
content: "\A";
white-space: pre;
}
You are not interested in a lot of "solutions" to your problem. I do not think there really is a good way to do what you want to do. Anything you insert using :after
and content
has exactly the same syntactic and semantic validity it would have done if you had just written it in there yourself.
The tools CSS provide work. You should just float the li
s and then clear: left
when you want to start a new line, as you have mentioned:
See an example: http://jsfiddle.net/marcuswhybrow/YMN7U/5/