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 the Listing below, which defines box model properties for an inline <span> tag.

Listing Explicit box size

Get hands-on with 1400+ tech skills courses.