shape-margin プロパティ

shape-margin プロパティは、 shape-outside プロパティで定義された形状の周りのマージンを設定します。 これにより、形状とそれを回り込むテキストとの間隔を広げることができます。

構文

cssセレクタ {
  shape-margin: 値;
}

例

20px のマージンを持つ円:

html<div class="shape"></div>
<p>
  some long text
</p>
css.shape {
  width: 150px;
  height: 150px;
  float: left;
  shape-outside: circle(50%);
  shape-margin: 10px;
  clip-path: circle(50%);
  background: #3498db;
}

p {
  width: 500px;
  text-align: justify;
}

Результат:

例

1em のマージンを持つ三角形:

html<div class="shape"></div>
<p>
  some long text
</p>
css.shape {
  width: 150px;
  height: 150px;
  float: left;
  shape-outside: polygon(0% 0%, 100% 50%, 0% 100%);
  shape-margin: 1em;
  clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
  background: #e74c3c;
}

p {
  width: 500px;
  text-align: justify;
}

Результат:

関連項目

  • 回り込みの形状を定義するプロパティ shape-outside
  • 要素の可視形状を作成するプロパティ clip-path
  • shape-margin の動作に必要なプロパティ float