The usage of <dev> rather than more semantic tags?

In most CSS course (specially in grids) HTML codes only uses <div> not some codes like <section> <main> and other tags that have more semantic meaning. Anyone has idea why is that?

Hello @baianbob, welcome to the forums! I’m not entirely sure, but there could be a few reasons:

  1. To get you used to dealing with ids and classes
  2. Because the developers who wrote the lessons didn’t want to use these tags/they felt they weren’t appropriate.

I hope this helps!

3 Likes

Hey there @baianbob :slight_smile:

Your question says <dev> though I’m guessing you meant <div>.
Also, because of the way the forums work, HTML tags are rendered as HTML and not as raw text, so no one can see the other HTML tags you posted. In order to display HTML as raw text simply wrap the in a set of backticks/backquotes —> ```

The look a lot like a single quote but are tilted slightly to the left.

I can’t say for sure on how the lesson is structured, but when writing HTML(especially with grids) there are times when there is not a semantic element that is fitting to use, yet you still need to group a section of code together for styling or interactivity.
Say for example you want to group together the fourth row of the grid, there is no semantic element for this purpose(that I know of or could find with a Google search), so a <div> works perfectly.

In fact consider that each item being in the grid needs to be fit in the grid, or suppose you have multiple elements you want to box together to fit in one space. The <div> is again great for that, as its purpose is to box items together for styling or interactivity, without adding any semantic meaning.


Of course, I do remember there being a good many lessons in which there were more semantic elements and for these, as @codeneutrino said, it probably came down to the developers choice, and they felt semantic was not the right way to go for CSS lessons.

2 Likes