Does the css content property break the rule of content and separation because css is for presentation not to generate content?
What are other good uses of the css content property? I’ve seen it only in clearfix hacks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Good point. I’d say it does if it’s used for actual data.
The quirksmode page on content shows the limitations pretty well. You can’t add any kind of styled content at the moment – it will work with too few browsers. You can add only character data.
The author of the quirksmode airs an interesting opinion:
I agree with this in general, but sometimes there may be cases where you don’t want to rely on JavaScript to do the job. The comma example shown by Martin is a case where I find using
contentjustified (although I personally would be feeling better if the commas would already be served coming from server side – it’s what I personally would stick to.)Also, keep in mind that adding commas and quotes through the
contentproperty may look bad when your content is viewed from elsewhere – for example in a search results page.I’d say use it only sparingly, if you really need it.