skip to Main Content

I am trying to use the glyphicons from twitter bootstrap. I want to use the pseudo-element :after instead of before.

.glyphicon.glyphicon-search:before
The above works just fine.

.glyphicon.glyphicon-search:after
The above does not work.

What am I doing wrong?

2

Answers


  1. Maybe it is syntax issue.
    Try .glyphicon.glyphicon-search::after

    Login or Signup to reply.
  2. It’s because the glyphicon classes are only intended for use with :before and not :after. If you check out the source code in the CSS you’ll see. An example would be:

    .glyphicon-asterisk
    

    the css for this looks as so:

    .glyphicon-asterisk:before {content: "2a";}
    

    if it was like this:

    .glyphicon-asterisk:before,
    .glyphicon-asterisk:after {content: "2a";}
    

    you would be able to do your thing. You’ll need to create a new class and add the content like this:

    .glyphicon-asterisk:after {content: "2a";}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search