Skip to main content

Command Palette

Search for a command to run...

Selector in CSS

Published
•1 min read•View as Markdown

What is Selector:

A CSS selector is the CSS rule that can specify the pattern of element and other terms that tell the browser which HTML element should be selected .

Element Selector:

The element selector selects HTML elements based on the element name.

Universal Selector:

The universal selector (*) selects all HTML elements on the page. Universal selector denoted by * and we can write any html and CSS tag or element inside the curly brackets {} that can apply whole page.

Class Selector:

The .class selector selects elements with a specific class attribute. We can create class write a period (.) character and apply where you want like <div>and element selector etc. This selector is mostly used in CSS.

ID Selector:

Id is a unique selector available in CSS so we should not used same id in multiple place. To select an element with a specific id, write a hash (#) character, followed by the id of the element.

Grouping Selector:

The grouping selector selects all the HTML elements with the same style definitions. IN other hand we can say that group selector can select multiple elements.