Lecture
Automatically Calculating Margin
What happens when you assign the "auto" value to a margin?
The auto value means 'automatically calculate the margin.'
For example, setting margin: auto; will automatically calculate and set equal margins on the left and right sides of an element, effectively centering the element. margin: auto; is commonly used in CSS for centering elements.
Note that you cannot assign the auto value to padding. In other words, padding: auto; is not valid CSS.
Padding deals with internal spacing within an element, which is typically determined by the size or content of the element.
Lessons in this chapter ยท Creating a Hero Section
- 1. Adding Space to Elements
- 2. Setting Margin Orientation
- 3. Defining Margin and Padding with CSS
- 4. Automatically Calculating Margin
- 5. HTML a Tag
- 6. a Tag target Attribute
- 7. SVG Tag
- 8. Decorating Links
- 9. Flex Layout 1
- 10. Flex Layout 2
- 11. Applying Flex Layout
- 12. Creating a Self-Introduction Section Using Flex
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help