Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:05:07+00:00 2026-06-07T16:05:07+00:00

CSS2.1 pseudo-selectors such as ::after and ::before allows to add text content to the

  • 0

CSS2.1 pseudo-selectors such as ::after and ::before allows to add text content to the page. For example :

CSS

 p:after { content:' Batman!' }

HTML

<p>Na Na Na Na Na Na</p>

Output in the browser

Na Na Na Na Na Na Batman!

My question, with the same HTML source, is why this piece of CSS

 p { content:'My hero is' }
 p:after { content:' Batman!' }

doesn’t outputs this

My hero is Batman!

but instead outputs this ?

Na Na Na Na Na Na Batman!

The w3c spec on the content property : http://www.w3.org/TR/CSS21/generate.html#propdef-content


Answer – I was looking at the CSS2.1 spec. The CSS3 spec indicates it is possible even without ::after and ::before pseudo-selectors. But not every browser implements it.

  • Chrome 20.0.1132.57 : NO
  • Opera 12.00 r1467 : YES
  • Safari 5.1.7 (7534.57.2) : NO
  • IE 8.0.7601 : NO (the CSS2 content property is not even implemented)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:05:10+00:00Added an answer on June 7, 2026 at 4:05 pm

    The CSS 2.1 spec cited says: “Applies to: :before and :after pseudo-elements”. This restriction has been relaxed in the draft for CSS3 Generated and Replaced Content Module, which is old (2003) and outdated but still partly implemented. Opera seems to support content for normal elements, except for the use of URL values (used to insert images), whereas Chrome and Safari do the same only for URL values. So you code actually works on Safari.

    More widespread support is not very likely unless specification work on the module makes some progress. On the W3C CSS module status page, the module is in the “Rewriting” section, with the note “Severely outdated”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I convert a CSS3 or CSS2-based HTML page into a JPEG or
Should we think about CSS media other than screen and print? http://www.w3.org/TR/CSS2/media.html#media-types all Suitable
I'm following the standard of W3C here http://www.w3.org/TR/CSS2/ui.html and here http://www.quirksmode.org/css/cursor.html#note . However, the
I was just curious as to what CSS Pseudo selectors everyone thinks are safe
Possible Duplicate: wrapping the text inside div - css Fiddle: http://jsfiddle.net/aTFK2/2/ HTML: <div id=ChannelDescription>ThisIsAVeryLongTextWithoutAnySpacesLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmed</div>​
I am completely lost. The website I check for CSS-defaults is always http://www.w3.org/TR/CSS2/sample.html (I
I'd like to use CSS2 selectors ( parent > child , element:first-child , etc)
Let's say I have css1.css and css2.css. Just for the sake of keeping files
I'm using some CSS properties that does not support in CSS 2.1. For example,
Is there any functional difference between the CSS 2.1 :after and the CSS 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.