CSS MARGINS Flashcards
css margins
The CSS margin properties are used to create space around
elements, outside of any defined borders.
css margins
The CSS margin properties are used to create space around
elements, outside of any defined borders.
properties
- margin-top
- margin-right
- margin-bottom
- margin-left
shorthand property
shorten- 1 syntax
* margin-top
* margin-right
* margin-bottom
* margin-left
*margin: 25px 50px 75px 100px;
if only 3 values
*margin: 25px 50px 75px;
*top margin is 25px
*right and left margins are 50px
*bottom margin is 75px
If the margin property has two values:
*margin: 25px 50px;
*top and bottom margins are 25px
*right and left margins are 50px
1 property value
*margin: 25px;
*all four margins are 25px
AUTO VALUE
- horizontally
center the element within its container.
div { width: 300px; margin: auto; border: 1px solid red;
inherit value
inherits value from parent (div)
div { border: 1px solid red; margin-left: 100px; } p.ex1 { margin-left: inherit; }
outline ofset
- adds space between an outline and the
edge/border of an element. - space is transparent
outline; 1px solid red;