DEV Community

Kunal Agrawal
Kunal Agrawal

Posted on

2 2

CSS Selectors.

CSS selectors, these are used to select a particular or group of tags sharing some common thing like class name, id, (siblings), tag name.

Selectors follow specificity (say priority), for example if there is a tag having class = a and id = b. If you're selecting a element with a and b then CSS property given to b are applied.

You can read more about css selectors here.

Basic Selector

Universal Selector

selects all the elements, denoted by *.

Type Selector

This selector selects all elements with same tag name.
tag_name.

Class Selector

This selector selects all elements with class name that is selected.
class_name.

ID Selector

This selector selects element with a id.
many elements can have one id, but use class for this, it's just convention.
id_name.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay