Css-margin-left
提供:Dev Guides
CSS-左マージン
説明
_margin-left_プロパティは、要素の左側のマージンの幅を設定します。
可能な値
- length -長さの値。
- percentage -マージンの幅は、要素の包含ブロックの幅に対して計算されます。
- auto -デフォルト、ブラウザにマージンを自動的に設定させます。
に適用されます
すべてのHTML要素。
DOM構文
object.style.marginLeft = "5px"
例
ここに例があります-
<html>
<head>
</head>
<body>
<p style = "margin-left: 15px; border:1px solid black;">
This is a paragraph with a specified left margin
</p>
<p style = "margin-left: 5%; border:1px solid black;">
This is another paragraph with a specified top margin in percent
</p>
</body>
</html>
これにより、次の結果が生成されます–