css - prevent :after element from wrapping to next line -
i have html:
<ul> <li class="completed"><a href="#">i want icon stay on same line last <strong>word</strong></li> </ul> i'm appending icon using :after pseudo element:
ul li.completed a:after { background:transparent url(img.png) no-repeat; content: ''; display:inline-block; width: 24px; height: 16px; } the problem: if available width small, icon wraps next line. want stay on same line last word of link it's appended to:

is doable, without adding 'nowrap' entire link (i want words wrap, not icon).
see jsfiddle here.
you can add image last word instead. make break together.
add class word <strong class="test">word</strong>
and .test:after { ...
the trick make class inline-block
and if want keep underline see this.
add text-decoration:inherit;
Comments
Post a Comment