property

margin-right — CSS reference

Sets the physical right margin edge. Initial zero; not inherited. A percentage uses the containing block inline size, even for top or bottom. Negative lengths are valid; auto is layout-dependent. This is not a direction-relative property.

Formal Syntax & Structure

css syntaxcss
<length-percentage> | auto

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS box geometry lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#parent{width:200px;display:flow-root} #a{margin:0;margin-right:10%;width:80px;height:20px}</style><body><div id="parent"><div id="a" class="sample">Box</div></div></body></html>
CSS Reference