CSS: Applying padding to the 4 sides of the element

This entry is part 19 of 26 in the series Basic CSS

By default margin and padding attributes apply to all four sides of an element.

You can add top, right, bottom and left arguments to restrict formatting to one or more specific sides.

<style>
        #padding {
            padding-left: 40px;
            padding-top: 30px;
            padding-right: 20px;
            padding-bottom: 10px;
            border: 1px solid;
        }
</style>

We can also use % as the unit of the measurement.

Series Navigation<< CSS: Margin
CSS: Using % for indentation and padding >>