Margin Properties
Margin properties in CSS has to do with the space around elements. One can tackle all margins at one time by using the following css:
p
{
margin: 2cm 4cm 3cm 4cm
}
Or else, one can make use of margins seperately in terms of:
- margin-top
- margin-bottom
- margin-left
- margin-right
Margins may also be given negative numbers in order to overlap elements on top of each other. Example:
p
{
margin-bottom: -30px;
}
Below is a graphic to better explain which part is the margin part. The other properties (padding, border) will be dealt later on this course:
