Chapter 16. Borders and Boxes

<feature><title>What You’ll Learn in This Hour:</title>
  • What the four sides of each box are called, and how to refer to them in CSS rules

  • How to use the margin shorthand property to specify margins for specific sides of a box

  • Which margin values to set to center boxes horizontally

  • How to set the padding on each side of a box

  • Which width, color, and line styles can be used on box borders

  • How to set borders for specific sides of the box

  • Which properties and values enable you to hide the display of a box and its contents

Within the CSS visual formatting model, all HTML elements are displayed as either inline boxes or block boxes. Property values in CSS rules affect the way these boxes are displayed by applying the styles to ...

Get Sams Teach Yourself CSS 24 in Hours 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.