Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select all direct descendant dom elements regardless of type

I'm trying to apply CSS to any immediate child of a parent container element. How do I use CSS's descendant < selector to select any immediate child regardless of type (div / span / etc).

like image 770
mheavers Avatar asked Mar 08 '13 20:03

mheavers


People also ask

Which selector will give all direct children?

The second selector above is a child combinator selector. This means it will only select list items that are direct children of an unordered list. In otherwords, it only looks one level down the markup structure, no deeper.

How do you select all elements in a div CSS?

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

How do you select all child elements except last?

When designing and developing web applications, sometimes we need to select all the child elements of an element except the last element. To select all the children of an element except the last child, use :not and :last-child pseudo classes.


1 Answers

I assume you mean the child selector. It's >, not <.

.parent > * 

That will select any element. You can of course use any other selector as the child (an element, class, id, etc.)

like image 122
Explosion Pills Avatar answered Sep 22 '22 16:09

Explosion Pills