Why does "tags" exist if there are classes and identifiers in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does "tags" exist if there are classes and identifiers in HTML?

I can't understand why they exist if it has no special attributes.

18th May 2019, 8:31 PM
Roberto Sevilla Varela
Roberto Sevilla Varela - avatar
2 Answers
+ 4
Classes and IDs have been created to allow style changes for only one or more tag. Tags are really helpful to identify the different parts of the code. Without the body, the footer, and the head tags, it would be really hard to find out where one part end and the next starts. Also, tags have specific functions that could not be easily replaced by using classes and identifiers: for example, the <form> tag allows to create a form, the <hr> element is used to represent a thematic break between paragraph-level elements and the <head> contains information about an HTML document that is used by browsers and web crawlers but is not displayed to website visitors. So, in conclusion, classes and IDs are helpful in the styling process, since they allow to style different elements in once, but tags are fundamental for the correct functioning of the entire website.
19th May 2019, 2:41 AM
PacoB
PacoB - avatar
0
Oh okok I get it know, great answer!
20th May 2019, 7:46 PM
Roberto Sevilla Varela
Roberto Sevilla Varela - avatar