New! My 44-page ebook "CSS in 44 minutes" is out! 😃
#margin-left
Defines the space outside the element, on the left side.
default
margin-left: 0;
Removes any margin on the left.
margin-left: 50px;
You can use pixel values.
margin-left: 7em;
You can use (r)em values.
The value is relative to the font size:
- em: relative to the element's current font size
- rem: relative to
<html>
the root element's font size
margin-left: 30%;
You can use percentage values.
The percentage is based on the width of the container.
margin-left: auto;
The auto keyword will give the left side a share of the remaining space.
When combined with margin-right: auto
, it will center the element, if a fixed width is defined.