Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a "previous sibling" selector?

The plus sign (+) is for selecting the next sibling.

Is there an equivalent for the previous sibling?

like image 240
Jourkey Avatar asked Nov 30 '09 04:11

Jourkey


People also ask

What is general sibling selector?

The general sibling selector selects all elements that are next siblings of a specified element.

Which answer is an example of a type selector also sometimes referred to as an element selector?

Type selectors A type selector is sometimes referred to as a tag name selector or element selector because it selects an HTML tag/element in your document. In the example below, we have used the span , em and strong selectors. Try adding a CSS rule to select the <h1> element and change its color to blue.

What is plus in CSS?

The “+” sign selector is used to select the elements that are placed immediately after the specified element but not inside the particular elements.

How do you select a child element in CSS?

The CSS child selector has two selectors separated by a > symbol. The first selector indicates the parent element. The second selector indicates the child element CSS will style.


1 Answers

No, there is no "previous sibling" selector.

On a related note, ~ is for general successor sibling (meaning the element comes after this one, but not necessarily immediately after) and is a CSS3 selector. + is for next sibling and is CSS2.1.

See Adjacent sibling combinator from Selectors Level 3 and 5.7 Adjacent sibling selectors from Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.

like image 168
cletus Avatar answered Sep 23 '22 04:09

cletus