Propiedad shape-margin

La propiedad shape-margin establece un margen alrededor de la forma definida por la propiedad shape-outside. Esto permite aumentar la distancia entre la forma y el texto que fluye alrededor de ella.

Sintaxis

cssselector {
  shape-margin: valor;
}

Ejemplo

Círculo con un margen de 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;
}

Результат:

Ejemplo

Triángulo con un margen de 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;
}

Результат:

Ver también

  • propiedad shape-outside,
    que define la forma para el ajuste de texto
  • propiedad clip-path,
    que crea la forma visible del elemento
  • propiedad float,
    necesaria para el funcionamiento de shape-margin