Boxing Inline Elements

In this lesson, we will learn how to set box size for inline elements. Let's begin!

We'll cover the following

Inline elements are also handled in a way other than block elements, and this is why you cannot set their size explicitly—or if you set, those size properties are ignored. However, you can still apply the box model properties (margin, border, and padding), but they generally provide a different result than you expect. Take a look at Listing 10-11, which defines box model properties for an inline <span> tag.

Listing 10-11: Explicit box size

Get hands-on with 1200+ tech skills courses.