Simply
li + li::before { content: " | "; }
Of course, this does not actually solve the problem of OP. He wants to free the vertical stripes at the beginning and end of the lines, depending on where they are broken. I will go to the limb and say that this problem is not solvable with CSS, and not even with JS, if you do not want to substantially rewrite the logic of the text dimension / layout / routing of the browser engine.
The only CSS snippets, as I see it, โknowโ about line breaks, firstly, the ::first-line pseudo-element, which doesnโt help us, - in any case, it is limited to several presentation attributes and does not work together with things like: : before and :: after. The only other aspect of CSS that I can come up with is to some extent revealing line breaks - wrapping. However, wrapping means adding a character (usually a dash) to the end of lines in certain situations, while here we are concerned about deleting a character (vertical line), so I just donโt see how to apply any logic related to wrapping, even with properties such as hyphenate-character .
We have a word-spacing that applies inside the line, but not at the beginning of the line and the ends, which seems promising, but determines the width of the space between words, and not the character (s) to be used.
I wonder if there is a way to use the text-overflow property, which has a little-known ability to take two values โโto display overflow text on the left and right, as in
text-overflow: '' '';
but there seems to be no obvious way to get from A to B.
user663031 Apr 21 '13 at 17:07 2013-04-21 17:07
source share