padding-block

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.

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 padding-block define el relleno lógico de inicio y final del bloque de un elemento, que se asigna a las propiedades físicas del relleno según el modo de escritura del elemento, la direccionalidad y la orientación del texto.

css
/* <length> values */
padding-block: 10px 20px; /* An absolute length */
padding-block: 1em 2em; /* relative to the text size */
padding-block: 5% 2%; /* relative to the nearest block container's width */
padding-block: 10px; /* sets both start and end values */

/* Keyword values */
padding-block: auto;

/* Global values */
padding-block: inherit;
padding-block: initial;
padding-block: unset;

Estos valores corresponde a las propiedades padding-top y padding-bottom, o padding-right, y padding-left dependiendo de los valores definidos por writing-mode, direction, y text-orientation.

Los valores pueden ser establecidos individualmente como padding-block-start y padding-block-end. La propiedad de dirección en línea es padding-inline que establece padding-inline-start, y padding-inline-end.

Valor inicialas each of the properties of the shorthand:
Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
Heredableno
Percentageslogical-width of containing block
Valor calculadoas each of the properties of the shorthand:
Animation typea length

Sintaxis

Valores

La propiedad padding-block toma los mismos valores que la propiedad padding-left.

Sintaxis formal

padding-block = 
<'padding-top'>{1,2}

<padding-top> =
<length-percentage [0,∞]>

<length-percentage> =
<length> |
<percentage>

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-rl;
  padding-block: 20px 40px;
  background-color: #c8c800;
}

Especificaciones

Specification
CSS Logical Properties and Values Level 1
# propdef-padding-block

Compatibilidad con navegadores

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
padding-block

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Mira también