This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > September 2005 > Overriding generated content inserted via the :before pseudo element
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Overriding generated content inserted via the :before pseudo element
|
|
| Spartanicus 2005-09-27, 7:12 pm |
| 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?
--
Spartanicus
| |
| Sander Tekelenburg 2005-09-27, 10:21 pm |
| In article
<4afjj1hgrq4p9a3fq89fqacp3sukk38hcd@news.spartanicus.utvinternet.ie>,
Spartanicus <invalid@invalid.invalid> wrote:
> 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?
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.
--
Sander Tekelenburg, <http://www.euronet.nl/%7Etekelenb/>
| |
|
|
| Spartanicus 2005-09-28, 3:32 am |
| Sander Tekelenburg <user@domain.invalid> wrote:
>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.
--
Spartanicus
| |
| Spartanicus 2005-09-28, 6:25 am |
| Sander Tekelenburg <user@domain.invalid> wrote:
>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 :)
--
Spartanicus
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|