From the course: CSS Fundamentals: Unlock the Power of Web Styling

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Setting margins and padding

Setting margins and padding

- [Instructor] As you work with CSS, you'll undoubtedly work a lot with margins and paddings. In this lesson, I'd like to look a little closer at these properties. Padding is that clear or transparent space that sits between the edge of an element and its border. And you can specify padding in several ways. First, you can define padding individually for each side of the element, moving from clockwise from top, right, bottom, and left. Now keep in mind, however, that setting padding in only one direction is not the same as setting padding to zero and the others. For instance, if I set the padding top to 40 pixels, that doesn't necessarily mean that the right, bottom, and left paddings are set to zero. Remember, there may be some default browser styles at play. As an alternative to specifying the padding for each side individually, you can also use a shorthand notation, and there are four variations on this. First, we can…

Contents