user1249791
user1249791

Reputation: 1271

How are unknown/invalid pseudo-classes in CSS selectors handled?

What does this CSS selector should point to? AFAIK :bar pseudo-class does not exist...

.Today_s_foo:bar
{
 font-size: 21px;
 font-family: "Ubuntu";
}

Upvotes: 2

Views: 1212

Answers (3)

Wayne Smith
Wayne Smith

Reputation: 4868

Correction applied

The rules in .Today_s_foo will not be set on any working browser.

I thought it was listed as an Unrecommended hack on http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml

IE

.Today_s_foo:IE6 /* IE6 hack */

but its not there.

Upvotes: 1

ScottS
ScottS

Reputation: 72271

Per the current specification for parsing errors in selectors: "the entire rule in which the selector is used is dropped." See also this part of the spec for an example of the consequences.

By "rule" it means every property setting inside the {brackets} will be ignored if any part of the selector is parsed as invalid.

Upvotes: 3

biziclop
biziclop

Reputation: 14616

Normally it should invalidate the whole rule, which may be important when using multiple selectors in one rule, see simple example: http://jsfiddle.net/S56xM/

HTML:

<div>Hello!</div>

CSS:

div, div:foobaresque { font-size: 100px; }

You will see that the div { font-size: 100px; } "sub-rule" is not applied, even if our mind tells us it would be applied.

Upvotes: 3

Related Questions