ID selector:

An ID selector is a type of CSS selector that is used to select an element based on its unique ID attribute. An ID selector is preceded by a hash (#) character and is used to target a single, unique element on a page. For example, if you have an element with an ID of “main-content”, you would use the following selector to target it:

#main-content {
/* CSS styles go here */
}

Class selector:

A class selector is a type of CSS selector that is used to select an element based on its class attribute. A class selector is preceded by a period (.) character and is used to target multiple elements on a page. For example, if you have multiple elements with a class of “highlight”, you would use the following selector to target them:

.highlight {
/* CSS styles go here */
}

Leave a Reply

Your email address will not be published. Required fields are marked *