margin-left property
The margin-left property sets a margin
at the left of an element. The value of the
property is any
size units
or the key property auto, which allows
the browser to independently calculate
the element margin.
Syntax
selector {
margin-left: value;
}
Example
Let's give the block the 50px
left margin:
<div id="parent">
<div id="elem"></div>
</div>
#parent {
border: 1px solid green;
display: inline-block;
}
#elem {
margin-left: 50px;
border: 1px solid red;
width: 100px;
height: 100px;
}
:
See also
-
the
margin-topproperty
that sets a top margin -
the
margin-bottomproperty,
that sets a bottom margin -
the
margin-rightproperty
that sets a right margin -
the
marginproperty
that is a shorthand for a margin -
the
paddingproperty
that sets a padding