CSS ID SELECTOR
CSS id selector is used to select an element using the id attribute.
An id is used for many purposes like
- creating page link
- Adding CSS property to the element
Here in this section we will mainly focus on CSS implementation of id.
Same as CSS class we can use CSS id to add style to the element it is defined to. From CSS point of view there is no difference between class and id.
Unlike CSS class id can't be used more than once in any webpage.
An id is defined by id_name preceded by a hash symbol ("#") .
Adding Id to an element
An id is added to an element by using the id attribute. As shown below
This paragraph is added with id1.