two solutions below: one with pure css, the second with jQuery, allowing any kind of symbol/image to be a separator
pre: Fairly hard to formulate and find such questions/solutions so I am sorry if duplicating.
I have a multi-line, justified block with random(not entirely) text hyperlink elements (tags/categories/etc) without fixed width separated by "|" symbol and spaces around. Looks pretty much like a tag cloud but with a fixed font-weight, size and other formatting, can contain more than one word in a hyperlink element. The problem rises when a separator is placed just before the end of the line or at the beginning of the line, actually, it happens always one way or another as I set nowrap to link elements, so this looks really ugly. Seeking for a solution to remove separators in the beginning and end of the lines.
For better understanding I will try to draw an example here.
C++ | PHP | CSS | ASP |
JavaScript | jQuery
| HTML 5 | StackOverflow
Something like that, of course, with justification and much more lines in a row. And another drawing of what I want to achieve.
C++ | PHP | CSS | ASP
JavaScript | jQuery
HTML 5 | StackOverflow
So fixed number of elements in a line is not an option, fixed width is also not an option.
The only solution I came up with is to set font to monospace and to count symbols and print pragmatically line-by-line with server-side scripting, the downside, of course, is the monospace fonts. Seeking for a better solution like pure html/css (would be perfect), JavaScript/jQuery formatting after output.
Thank you in advance!
EDIT: answering to a comment below, markup can be anything you wish, basically something like:
<div><a href="#">tag 1</a> | <a href="#">tag 2</a> | <a href="#">tag 3</a></div>