- Declaration part
The element Selector
- The element selector selects elements based on the element name.
- As we have seen in example yesterday, you can select all
elements on an HTML page just using p as a selector. You can use any element name we have studied so far such as images, headings, tables, lists, list elements.
The id Selector
- The id selector uses the id attribute of an HTML element to select the element.
- The id should be unique on a page so that id selector is used for selecting one unique element.
- The element you want to select must have that id as the value of attribute id.
- To select that element using the id in CSS, write a hash(#) followed by the id of that element.
The class selector
- The class selector selects elements with given class attribute.
- To select element with the particular class, write a period(.) followed by the name of the class.
The Grouping Selectors
- We can add various elements as selectors by separating commas to use the same declarations for them.