Select box elements and :after

14,295

In your fiddle the following declaration is probably not doing what you expect.

select:after {content: "This doesn't work";}

This will actually append the text after the content of the select box, not after the select box itself. So that text is being added after the last option in the markup. (Which of course is neither valid, nor will it be rendered by the browser.)

In other words if you had this markup:

<a href="#">My link</a>

and this CSS:

a:after {content: " has now been appended to";}

What is actually happening is this:

<a href="#">My link has now been appended to</a>
Share:
14,295
Rane
Author by

Rane

Updated on August 09, 2022

Comments

  • Rane
    Rane about 1 month

    Why doesnt it work? Is there a work around for this without adding an extra element?

    http://jsfiddle.net/86gb2/

  • Rane
    Rane almost 10 years
    I know that. But i didnt think of it when it was for the select element..I used a wrapper instead, then it worked like i wanted :)