Chapter 5. Getting to Know the CSS Box Model

In this lesson, you will learn about the CSS box model—the rectangular boxes that are generated for all HTML elements. You will learn about aspects that make up the box model, including margin, background color, background image, padding, and border. You also will learn the difference between inline and block level elements.

Understanding Inline and Block Level Elements

Block level elements are normally displayed as blocks with line breaks before and after. Examples of block level elements include paragraphs, headings, divs, and block quotes.

Inline elements are not displayed as blocks. The content is displayed in lines and there are no line breaks before and after. Examples of inline elements include ...

Get Sams Teach Yourself CSS in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.