Jump to content

The :before and :after Pseudo-elements


cecilia

Recommended Posts

I´m reading the CSS tutorial and I just read about the :before and :after Pseudo-elements. Can somebody tell me when I could need these elements?Because I can´t guess for what I´d want to add some sound or something after or before a i.e. h1 ocurrs.Thanks!

Link to comment
Share on other sites

Well let's say you wanted your headings to be in bracket [like this]. You could do:h1:before { content: "["; }h1:after { content: "]"; }Also you can decide to disable or enable quotation marks around quotes like this:q:before { content: open-quote; }q:after { content: close-quote; }You can also use p:after { content: url(image.gif); } to place some signature image at the end of a paragraph, and so on.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...