DEV Community

Cover image for Id Classes Attributes tags
GiandoDev
GiandoDev

Posted on

Id Classes Attributes tags

If we need to select the element inside the html we have to decide if we want to select one element or multiple elements.
In the first case id is perfect, we can't name two elements with the same id ( the id is unique ).
Alt Text
To select more than one element we may use classes or attribute.
Alt Text
In general we use classes to select multiple elements and attribute to filter through them.
Alt Text
It`s a good practice to use js prefix for the elements that require javaScript to work.
Alt Text

Top comments (0)