Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / September 2005



Tip: Looking for answers? Try searching our database.

Overriding generated content inserted via the :before pseudo element

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Spartanicus - 27 Sep 2005 22:57 GMT
http://homepage.ntlworld.com/spartanicus/temp3.htm

p:before{content:"foo"}
p:before{content:none}

<p>bar</p>

renders as "foobar". I thought that according to the "latter specified
wins if two rules have the same weight, origin and specificity" cascade
rule it would render as "bar", but apparently I'm missing something. Can
someone point me to the spec section that explains this behaviour?

Signature

Spartanicus

Sander Tekelenburg - 28 Sep 2005 03:20 GMT
In article
<4afjj1hgrq4p9a3fq89fqacp3sukk38hcd@news.spartanicus.utvinternet.ie>,

> http://homepage.ntlworld.com/spartanicus/temp3.htm
>
[quoted text clipped - 7 lines]
> rule it would render as "bar", but apparently I'm missing something. Can
> someone point me to the spec section that explains this behaviour?

content:none isn't valid CSS, so it's up to the user-agent to decide
what to do. Refusing to render invalid code isn't considered acceptable
by the public, so it is to be expected that a user-agent will simply
ignore the rule.

If you change to this

p:before{content:"foo"}
p:before{content:""}

<p>bar</p>

the user-agenst should render "bar". iCab, Safari, Mozilla and Opera all
do.

Signature

Sander Tekelenburg, <http://www.euronet.nl/%7Etekelenb/>

Spartanicus - 28 Sep 2005 07:34 GMT
>content:none isn't valid CSS

http://www.w3.org/TR/CSS21/generate.html#content

Signature

Spartanicus

Sander Tekelenburg - 28 Sep 2005 10:05 GMT
In article
<6fekj1dn2d9jihstdlfj8rngnsupo39l03@news.spartanicus.utvinternet.ie>,

> >content:none isn't valid CSS
>
> http://www.w3.org/TR/CSS21/generate.html#content

Oh my. Turns out I was looking at a local copy of an earlier draft
(2004-02-25) which didn't yet contain this...

Btw, the section on changes between CSS 2.0 and 2.1 doesn't list this
change. Seems like this change is so recent it didn't even make it into
the change log. Not too surprising then that browsers don't support it
yet (besides, CSS 2.1 is still only a draft anyway). Or perhaps the
change log simply contains a typo? Something about that sentence at
<http://www.w3.org/TR/CSS21/changes.html#q4> confuses me.

Signature

Sander Tekelenburg, <http://www.euronet.nl/%7Etekelenb/>

Spartanicus - 28 Sep 2005 11:18 GMT
>Btw, the section on changes between CSS 2.0 and 2.1 doesn't list this
>change. Seems like this change is so recent it didn't even make it into
>the change log.

Good catch.

>Not too surprising then that browsers don't support it
>yet (besides, CSS 2.1 is still only a draft anyway).

I tend to think of CSS 2.1 primarily as clarifying issues with 2.0 and
removing stuff that wasn't implemented, I forgot that there were minor
changes, and a few additions other than inline-block.

>Or perhaps the change log simply contains a typo?

I'll mention it on the w3c style mailing list.

>Something about that sentence at
><http://www.w3.org/TR/CSS21/changes.html#q4> confuses me.

Same here :)

Signature

Spartanicus

Spartanicus - 28 Sep 2005 08:00 GMT
>content:none isn't valid CSS

Just discovered that it's in CSS 2.1, but not in CSS 2.0. That's the
first time that I've been caught out in using CSS 2.1 and finding that
modern browsers still implement the CSS 2.0 values.

Signature

Spartanicus

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.