<div> VS Semantic HTML

I’ve reached the lesson regarding Semantic HTML, and I understand that it helps with SEO, people with disabilities, and mobile views of websites, etc.

What I’m curious of is can you use both <div> and semantic HTML? Will it affect the code in any way? It seemed as though the usefulness of <div> was to add the “id” attribute and be able to link to that area using the <div>. Can you still do that with semantic HTML tags?

Thanks!

1 Like

Yes, you can add an id attribute to a semantic HTML element the same as you could a <div>.

So, <div id="some-text"></div> is fine and so is <section id="about-brown-bears"></section>.

3 Likes