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

Block element and block box

I'm attempting to comprehend the relationship here of a block element and a block box. A block level element has particular characteristics regarding width, padding, margin, spacing, etc. Is the term block box used to encompass these characteristics when creating a layout on the document?

Any clarification is appreciated.

3 Answers

Ran ShemTov
Ran ShemTov
14,148 Points

It's hard for me to understand what do you mean by "block box", this term doesn't really exist (or i've never heard of it). A block element is an element that shares no room with other elements, and has its hight and width definable. You got also inline-block, which allows you several blocks inside a specific line (like a set of pictures one besides another). inline-block elements will also have their properties defineable.

It might be good to choose two elements and examine the differance between block and inline-block in order to fully understand which one should be used on which case.

Feel free to ask any further questions

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Benjamin.

Every takes up a certain amount of space like in a box as you suggest. It's called the box model. But each element is one of two different element types.

  • Block level elements
  • Inline level elements

Block level elements have width and height, padding, margin, and border layers and each of these contribute to the amount of space on your screen that the element takes up.

Inline level elements are different as they only take up as much width as the amount of content it has. These are things like your anchor and span elements.

Hope this helps :)

This is what my question derived from for those wondering:

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Visual_formatting_model