CSS TutorialLesson 11Free preview
CSS Padding
This lesson is part of CSS · All levels
Summary
Padding is the space within the element between the content and the border. Adding padding makes the content move away from the borderline so the view is lighter. Like the margin, the padding can be set side by side or shorthand, but the padding should not be negative.
Key points
- The padding is located inside the border, surrounding the contents of the element.
- Shorthand padding follows a pattern of up, right, down, left clockwise.
- The background of the element comes to cover the padding area, as opposed to the margin that is always empty.
- Padding doesn't take a negative.
- Padding: 0 removes interior space; often used to refine elements such as lists or images.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.