From the course: CSS: Display

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Understanding proper nesting of block and inline elements

Understanding proper nesting of block and inline elements - CSS Tutorial

From the course: CSS: Display

Start my 1-month free trial

Understanding proper nesting of block and inline elements

- [Instructor] As you've seen in the last two videos, block and inline are two really core concepts to CSS and to HTML. And so I thought I'd present the last very important concept in terms of block and inline. And that is how you can nest block and inline HTML elements within your document. Because I see these kinds of mistakes made often and I just want to point out what is so-called legal and illegal, where this is concerned. So let's just go on through these one by one. I put a little comment up here at the top to tell you what's legal and what's illegal. All right. So we can have block elements inside of block elements. That is a given. All of our block level elements are going to go inside of the body tag, which itself is a block level element. So this has to be legal, otherwise we can't build a webpage. Inline elements can go inside of block elements. We've seen that before. Say here on line 14, where we have…

Contents