The best CSS Margin (Margin) Tutorial In 2024, In this tutorial you can learn Margin,Possible values,Examples,Margin - shorthand property,Examples,More examples,All CSS margin properties,
CSS Margin (margin) property defines the space around elements.
clear margin around elements (outside the borders) area. margin no background color is completely transparent
margin can be changed on individual elements, bottom, left and right margins. You can also change once all the properties.
value | Explanation |
---|---|
auto | Set your browser margins. The result will depend on the browser |
length | Define a fixed margin (using the pixel, pt, em, etc.) |
% | Defined using a percentage margin |
Margin can use negative overlapping content.
In CSS, it can specify a different side of the different margins:
To shorten the code, it is possible to use all the margin properties in one property specified margin. This is called a shorthand property.
Shorthand property for all the margin properties is "margin":
margin property can have one to four values. / P>
Margin settings on the text using a cm value
This example demonstrates how to set up a text value centimeters of the top margin.
Set the text using the percentage value of the bottom margin
This example demonstrates how to set up using a percentage of the value of the bottom margin with respect to the width of the containing element.
Attributes | description |
---|---|
margin | Shorthand property. Set all margin properties in one declaration. |
margin-bottom | Setting outside of an element. |
margin-left | The element in the left margin. |
margin-right | The element of the right margin. |
margin-top | Element is set on the margin. |