CSS Margin | css margin-top
Marginsareusedtocreatespacearoundelements,outsideofanydefinedborders.Thiselementhasamarginof70px.TryitYourself»CSSMarginsTheCSSmarginpropertiesareusedtocreatespacearoundelements,outsideofanydefinedborders.WithCSS,youhavefullcontroloverthemargins.Therearepropertiesforsettingthemarginforeachsideofanelement(top,right,bottom,andleft).Margin-IndividualSidesCSShaspropertiesforspecifyingthemarginforeachsideofanelement:margin-topmargin-rightmargin-bottommargin-leftAllthemarginpropertiescanhavethefol...
Margins are used to create space around elements, outside of any defined borders.
This element has a margin of 70px.
Try it Yourself » CSS MarginsThe CSS margin properties are used to create space around elements, outside of any defined borders.
With CSS, you have full control over the margins. There are properties for setting the margin for each side of an element (top, right, bottom, and left).
Margin - Individual SidesCSS has properties for specifying the margin for each side of an element:
margin-top margin-right margin-bottom margin-leftAll the margin properties can have the following values:
auto - the browser calculates the margin length - specifies a margin in px, pt, cm, etc. % - specifies a margin in % of the width of the containing element inherit - specifies that the margin should be inherited from the parent elementTip: Negative values are allowed.
ExampleSet different margins for all ...