#margin-right
Defines the space outside the element, on the right side.
默认属性
margin-right: 0;
Removes any margin on the right.
margin-right: 50px;
You can use pixel values.
margin-right: 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-right: 30%;
You can use percentage values.
The percentage is based on the width of the container.
margin-right: auto;
The auto keyword will give the right side a share of the remaining space.
When combined with margin-left: auto
, it will center the element, if a fixed width is defined.