# Selector in CSS

### 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.

%[https://codepen.io/avinash57/pen/mdjPgzd] 

### 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.

%[https://codepen.io/avinash57/pen/mdjPgzd] 

### **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 &lt;div&gt;and element selector etc. This selector is mostly used in CSS.

%[https://codepen.io/avinash57/pen/mdjPgzd] 

### 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.

%[https://codepen.io/avinash57/pen/mdjPgzd] 

### **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.

%[https://codepen.io/avinash57/pen/mdjPgzd]
