This chapter aims to highlight fundamental aspects of working with dimensions in design, and strengthen your understanding of how the sizes of elements (and the negative space around them) can be adjusted. These skills will assist with your ability to control spacing and layout. This chapter will also introduce a number of HTML5 structural elements that can be used to semantically describe the role that elements onscreen play within the larger document.
<aside> <img src="/icons/list_purple.svg" alt="/icons/list_purple.svg" width="40px" />
By the end of this chapter you will:
box-sizing properties to work with dimensions in different waysThe box model in web design is an important way to explain how every element on a web page is treated as a rectangular box, and dictates how elements are structured (and interact with each other) in the layout. Understanding the box model is important for designing and laying out web pages effectively. It consists of four main components:
width and height properties.We’ve likely touched on a bunch of these words in class discussions/examples.
Some browsers' web inspectors (or developer tools) show a pictorial representation of the box model like this:

The Box Model: An illustration of the dimensions taken up by an HTML element. Content dimensions are shown in blue, padding is listed in green, border in yellow ochre, and margin in orange tan. The size of an element typically consists of the sum of these values.
When you hover over the element in the web inspector's 'Elements' view, it is highlighted in your browser like this:

Colour overlays depicting aspects of the Box Model: Semi-transparent overlays over the rendered content, highlight content dimensions in blue, padding in green, border in yellow ochre, and margin in orange tan.
… visually illustrating (by use over colour overlay) that the width and height of an element is the combination of margins, borders, padding, and content width/height.
The box model directly relates to the layout of a webpage because it determines the total size and spacing of elements. When calculating the space that an element occupies, you need to consider the sum of its margin, border, padding, and the actual content. This calculation is essential when you are trying to fit multiple elements within a specific area or when you're trying to precisely control the spacing between elements.