Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the '>' symbol in css mean? [duplicate]

Easy points here for anyone who knows. I am looking for a detailed answer on what it (>) means and how it should be used. Thanks.

like image 209
bkbarton Avatar asked Jul 03 '12 14:07

bkbarton


People also ask

What does '>' mean in CSS?

The greater than sign (>) selector in CSS is used to select the element with a specific parent. It is called as element > element selector. It is also known as the child combinator selector which means that it selects only those elements which are direct children of a parent.

What does adding * in CSS mean?

Definition and Usage The * selector selects all elements. The * selector can also select all elements inside another element (See "More Examples").

What does *:: After mean in CSS?

In CSS, ::after creates a pseudo-element that is the last child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.

What does the & symbol mean in CSS?

A nested & selects the parent element in both SASS and LESS. It's not just for pseudo elements, it can be used with any kind of selector. e.g.


1 Answers

There is no valid symbol as < in CSS. If you use it, you will invalidate your css.

However, you may want to use > - the child selector.

CSS4 will introduce a subject selector. At the moment it is marked with $.

so

$#parent a:hover{
   /* styles */
}

so these rules will not apply to the a in hoverstate, but it's parent with the parent-ID. CSS4 spec

like image 135
Christoph Avatar answered Oct 20 '22 06:10

Christoph