Is it possible add an icon after a link that breaks with the last word?
:after and content both break in Chrome.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For the markup
<a class="after" href="#">The icon should not break alone</a>, use the following CSS code:The addition of
'\feff'means adding U+FEFF ZERO WIDTH NO-BREAK SPACE, an invisible control character that prevents line breaks before and after. This helps on Chrome and IE, but not on Firefox. Addingwhite-space: nowrapdeals with the issue on Firefox; this is illogical since by definition it only prevents line breaks inside the pseudo-element, and the issue is a line break between the normal content and the pseudo-element—anyway, since it helps, let’s use it here.A more common approach is to add an icon as a background image for the
aelement, placed at the right. This avoids the line breaking issue.