0

Using class or id or using the designated tags

I am confuse over the use of div class on my header, nav or footer tags. Which one is better? Should I use the designated tags or better with class/id

30th Aug 2020, 10:30 AM
DN Josh
DN Josh - avatar
2 Réponses
+ 4
When you are certain that there won't be any more header, nav or footer elements, then you can use directly the tag name for styling But it is not a good practice, because sometimes If you are using some framework, and you directly target, let's say , the header Element in Css and added some property, then it could reflect to more places because your Css will override the one you have used from the framework
30th Aug 2020, 10:34 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
You should prefer semantic tags to frame a structure.div should be used inside that to create component. Class/id are preferred more than tag because it helps to target the tags in css/js/jQuery...and many more.
30th Aug 2020, 11:14 AM
Divya Mohan
Divya Mohan - avatar