All Questions

2279
votes
26answers
1310367 views

Is there a CSS parent selector?

How do I select the <li> element that is a direct parent of the anchor element? In example my CSS would be something like this: li < a.active { property: value; } Obviously there are ...
927
votes
12answers
407678 views

Is there a "previous sibling" CSS selector?

+ is for the next sibling. Is there an equivalent for the previous sibling?
993
votes
8answers
315169 views

Which characters are valid in CSS class names/selectors?

What characters/symbols are allowed within CSS class selectors? I know that the following characters are invalid, but what characters are valid? ~ ! @ $ % ^ & * ( ) + = , . / ' ; : " ? > < ...
620
votes
15answers
645561 views

CSS selector for first element with class

I have a bunch of elements with a class name red, I can't seem to select the first element with the class="red" using the following CSS rule: .red:first-child{ border:5px solid red; ...
62
votes
4answers
16999 views

Can I combine :nth-child() or :nth-of-type() with an arbitrary selector?

Is there a way to select every nth child that matches (or does not match) an arbitrary selector? For example, I want to select every odd table row, but within a subset of the rows: table.myClass tr....
367
votes
7answers
157153 views

What does the ">" (greater-than sign) CSS selector mean?

For example: div > p.some_class { /* Some declarations */ } What exactly does the > sign mean?
292
votes
12answers
237000 views

Is there a CSS selector for elements containing certain text?

I am looking for a CSS selector for the following table: Peter | male | 34 Susanne | female | 12 Is there any selector to match all TDs containing "male"?
260
votes
10answers
234674 views

Complex CSS selector for parent of active child

Is there a way to select a parent element based on the class of a child element in the class? The example that is relevant to me relating to HTML output by a nice menu plugin for http://drupal.org. ...
471
votes
3answers
59597 views

Why do browsers match CSS selectors from right to left?

CSS Selectors are matched by browser engines from right to left. So they first find the children and then check their parents to see if they match the rest of the parts of the rule. Why is this? Is ...
53
votes
1answers
10883 views

Why is my jQuery :not() selector not working in CSS?

I have this layout: <div id="sectors"> <h1>Sectors</h1> <div id="s7-1103" class="alpha"></div> <div id="s8-1104" class="alpha"></div> <div...

Previous Next