I have a div and I am placing some text in it via content in :before and :after. Can Google crawlers read this?


div:after {
    content: 'This is from CSS';

Working Example

  • 1
    Example is a 404
    – Max
    Oct 16, 2014 at 5:53
  • 2
    Google has smart people, I'd go for yes. I feel the urge to add: Don't use css to add (much) content, css is style. It should only be done when no other reasonable options remain.
    – Martijn
    Oct 16, 2014 at 7:44
  • Even if Google can read it, is it used to rank it? In the wild, this property is generally only used to add the odd symbol (or generic label) for presentation - so it's not usually worth (the effort) indexing. And as Martijn suggests, if designers add much real content to this property then they are breaking the content/presentation separation which is bad practise and something which I'm sure Google would not promote. But if Google is indexing rendered pages - like a human - then maybe...?
    – MrWhite
    Oct 16, 2014 at 8:35

1 Answer 1


Google does not reliably index text contained in JavaScript or CSS, even if it is visible to users on the page.

I found out about the JavaScript part recently when I asked How can I get Google to index content that is written into the page with JavaScript?

I also use text in css before on that site. If I search for the text that is in the CSS, Google does not know that those pages contain the text.

  • 2
    "Google does not index text contained in JavaScript" - It's a new thing, but I'm pretty sure it does. Oct 16, 2014 at 12:24
  • I know that Google finds links in JavaScript and crawls them. However, I can't get Googlebot to index text from JavaScript when I want it to. If you know of a way to make that happen, please answer my linked question. Oct 16, 2014 at 12:25
  • 1
    Google certainly claims to be "getting better" at rendering JS/CSS generated content for the purpose of indexing. And in my experience Google can index JavaScript generated content to some degree. I have an old site that has an unhealthy amount of content written to the page with JS and large chunks have been indexed. This isn't just where the content is "contained in the JavaScript", but the content has been generated from executing the JavaScript. But it's just not very reliable and very far from complete.
    – MrWhite
    Oct 16, 2014 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.