margin-block-start

Experimental: Esta es una tecnología experimental
Comprueba la Tabla de compabilidad de navegadores cuidadosamente antes de usarla en producción.

La propiedad de CSS margin-block-start CSS property defines the logical block start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation.

Pruébalo

Sintaxis

css
/* <length> values */
margin-block-start: 10px; /* An absolute length */
margin-block-start: 1em; /* relative to the text size */
margin-block-start: 5%; /* relative to the nearest block container's width */

/* Keyword values */
margin-block-start: auto;

/* Global values */
margin-block-start: inherit;
margin-block-start: initial;
margin-block-start: unset;

Esto corresponde a las propiedades margin-top (en-US), margin-right, margin-bottom, o margin-left (en-US) dependiendo de los valores definidos por writing-mode, direction, y text-orientation.

Se relaciona con margin-block-end (en-US), margin-inline-start, and margin-inline-end, que define las otras márgenes del elemento.

Valor inicial0
Applies tosame as margin
Heredableno
Percentagesdepends on layout model
Valor calculadoif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, auto
Animation typea length

Valores

La propiedad margin-block-start toma los mismos valores de la propiedad margin-left (en-US).

Sintaxis formal

margin-block-start = 
<'margin-top'>

Ejemplo

Contenido HTML

html
<div>
  <p class="exampleText">Example text</p>
</div>

Contenido CSS

css
div {
  background-color: yellow;
  width: 120px;
  height: 120px;
}

.exampleText {
  writing-mode: vertical-lr;
  margin-block-start: 20px;
  background-color: #c8c800;
}

Especificaciones

Specification
CSS Logical Properties and Values Level 1
# margin-properties

Compatibilidad con navegadores

BCD tables only load in the browser

Mira también