Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Mobile-First CSS Layout Mobile-First CSS Layout Centering Page Content and Creating a Full-width Header

Does it make a difference whether you use a <div> or <main> element to style the main content of the webpage?

In the video, the instructor uses a <div> element as a container to style the content between the <header> and the <footer>.

I'd have thought it would make more sense to use a <main> element in this case.

Is there a particular reason why a <div> is used rather than a <main> element?

2 Answers

Nikos Papapetrou
Nikos Papapetrou
6,305 Points

Yes you can use main for the main content of you site. It is more semantic and better for s.e.o reasons. Also instead of using all the time div it makes it a litte cleaner in they eye. So depends on your project you structure the main areas with these semantincs elements. <header> <main> <footer>

Thanks Nikos, very helpful.