HTML elements with attributes
3.5
Lesson

ID Attribute

Sometimes, we want to select only a single element to be changed with the use of CSS or JavaScript.

For this, we use the id attribute.

In the example above, we have grouped all the p elements together with their class attributes set to countries. But we have also set their id attributes and given them separate values, malaysia and egypt.