Utility Classes

Learn how to add borders, margins, and padding to the layout.

Utility classes are very helpful in improving the appearance of content on a webpage. As we saw in the previous layout, there is no space between the images and no image border, which looks unattractive to the user. Now, let's add some space between the images and establish the borders of each image with the help of utility classes.

Paddings, borders, and margins

A margin is a space surrounding the border, whereas padding is the space between the border and its content. The margin property governs the area around an element, and the padding property governs the area within an element. The illustration below helps show the concept more effectively.

Get hands-on with 1200+ tech skills courses.