Different div, but why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Different div, but why?

Hello there. I would be interested in knowing why there is a trend to use tags like article, aside or even the bigger ones like header, nav, footer, etc. preferable to a div in html5. To me it seems unprofessional to have something with the same purpose, of holding contend together, split up into many different tags. Please may someone explain to me why this is. Would irritate me if it was just about delivering metadata about the page, but I currently have no idea. Thank you very much :)

5th Feb 2018, 4:25 PM
Phy
Phy - avatar
4 Answers
+ 3
As mentioned, the metadata in that form is useful for the browsers, among many other things that analyze websites and its markup. Otherwise you'd have to constantly use some property on each and every DIV to signify which section it belongs to. This gives you a better means of going about it without creating a lot of redundancy. As well, it makes it more readable and clear about its intention. In all fairness, you're more than welcome to use only DIVs if that's what you're wanting to do. You're not required to utilize the other tags, they're simply there for their intended purpose. If you're not comfortable using them, then you can still go about much of what you're wanting to do without using them. It's more of a convenience thing than a forced thing.
5th Feb 2018, 4:40 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 2
Why would it irritate you if its purpose revolved around metadata? Metadata is important to the browser, as well as other systems like search engines, APIs, etc.. That's like if I wanted everyone to use tables (like we use to back in the day) instead of using something like DIV when we were using tables for the same purpose. ;) Structure and design is important even if you can generate the same functional results.
5th Feb 2018, 4:28 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
I still like to see metadata in other places, but I would feel as if it would just make sure by using tags other than div to have the metadata. We have no other element that exist in multiple forms only to carry out other metadata, do we?
5th Feb 2018, 4:32 PM
Phy
Phy - avatar
+ 1
I know that you can always go a lot of different ways to accomplish the same thing, we could even throw all of this over and just use tables. Honestly I'm just very surprised to hear that it is about the metadata.
5th Feb 2018, 4:44 PM
Phy
Phy - avatar