Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine CSS Attribute Selectors

Tags:

html

css

is there a way to combine CSS2 Attribute Selectors like tr[id^="foo" AND id$="bar"], so it selects all <tr id="foo_something_bar"> but not <tr id="foo_something"> or <tr id="something_bar">

like image 619
user354411 Avatar asked May 31 '10 08:05

user354411


People also ask

How do you combine selectors?

The descendant combinator — typically represented by a single space (" ") character — combines two selectors such that elements matched by the second selector are selected if they have an ancestor (parent, parent's parent, parent's parent's parent, etc.) element matching the first selector.

How do I group multiple selectors in CSS?

The CSS grouping selector is used to select multiple elements and style them together. This reduces the code and extra effort to declare common styles for each element. To group selectors, each selector is separated by a space.

How do you group selectors CSS?

To group selectors, separate each selector with a comma.


1 Answers

The same way you combine any selectors.

tr[id^="foo"][id$="bar"]

Those two substring matching selectors, however, are being introduced in the CSS 3 draft. They are not CSS 2.

like image 66
Quentin Avatar answered Oct 02 '22 18:10

Quentin