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!

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

HTML HTML Basics Structuring Your Content Semantic HTML: <header>, <footer> and <section>

Leo Penaloza
Leo Penaloza
8,426 Points

Question about <Sections>

What's the difference between the three? <div> <span> <section> they seem the same by they way they are used, from what I know a <div> is a block type tag and that a <span> is a inline tag, but how does <section> compare?

1 Answer

Shay Paustovsky
Shay Paustovsky
969 Points

Hi Leo,

<div>, <span>, <section> tags are all semantic markup that simply gives meaning to the text between them.

<div> & <section> do have a "block" display property by default but that is not what differentiates them.

DIV - is more used as a generic wrapper/container simply for styling purposes, and does not hold a meaning.

SECTION - denotes a section in your website - (welcome, contact, about, etc...) essentialy a thematic break in content.

SPAN - is the same purpose as a <div> but for text, it's a generic container for text styling purposes VS the <div> that is a generic container for other tags like <section>.

Later when learning CSS Layout, you will understand that <div's> purpose is to control layout width and grouping.

Hopefully I've cleared some confusions

~ Shay ~