min-block-size

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.

* Some parts of this feature may have varying levels of support.

Expérimental: Cette fonction est expérimentale
Puisque cette fonction est toujours en développement dans certains navigateurs, veuillez consulter le tableau de compatibilité pour les préfixes à utiliser selon les navigateurs.
Il convient de noter qu'une fonctionnalité expérimentale peut voir sa syntaxe ou son comportement modifié dans le futur en fonction des évolutions de la spécification.

La propriété min-block-size définit la taille minimale horizontale ou verticale d'un élément de bloc (block) selon le mode d'écriture utilisé. Cette propriété « logique » correspond à la propriété min-width ou min-height selon la valeur utilisée pour writing-mode.

Exemple interactif

min-block-size: 150px;
writing-mode: horizontal-tb;
min-block-size: 150px;
writing-mode: vertical-rl;
min-block-size: 20px;
writing-mode: horizontal-tb;
min-block-size: 15em;
writing-mode: vertical-lr;
<section class="default-example" id="default-example">
  <div class="transition-all" id="example-element">
    This is a box where you can change the minimum block size. <br />If there is
    more content than the minimum the box will grow in the block dimension as
    needed by the content.
  </div>
</section>
#example-element {
  display: flex;
  flex-direction: column;
  background-color: #5b6dcd;
  justify-content: center;
  color: #ffffff;
}

Si le mode d'écriture est orienté verticalement, min-block-size fait référence à la hauteur minimale de l'élément. Sinon, elle fait référence à la largeur minimale de l'élément. to the minimal height of the element, otherwise it relates to the minimal width of the element. La propriété min-inline-size peut être utilisée pour les éléments en ligne.

Syntaxe

css
/* Valeurs de longueur */
/* Type <length>       */
min-block-size: 100px;
min-block-size: 5em;

/* Valeurs proportionnelles à la */
/* largeur du bloc englobant     */
/* Type <percentage>             */
min-block-size: 10%;

/* Valeurs avec un mot-clé */
min-block-size: max-content;
min-block-size: min-content;
min-block-size: fit-content;
min-block-size: fill-available;

/* Valeurs globales */
min-block-size: inherit;
min-block-size: initial;
min-block-size: unset;

Valeurs

La propriété min-block-size peut prendre les mêmes valeurs que les propriétés min-width ou min-height.

Définition formelle

Syntaxe formelle

min-block-size = 
<'min-width'>

<min-width> =
auto |
<length-percentage [0,∞]> |
min-content |
max-content |
fit-content( <length-percentage [0,∞]> ) |
<calc-size()> |
<anchor-size()>

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

<calc-size()> =
calc-size( <calc-size-basis> , <calc-sum> )

<anchor-size()> =
anchor-size( [ <anchor-name> || <anchor-size> ]? , <length-percentage>? )

<calc-size-basis> =
<intrinsic-size-keyword> |
<calc-size()> |
any |
<calc-sum>

<calc-sum> =
<calc-product> [ [ '+' | '-' ] <calc-product> ]*

<anchor-name> =
<dashed-ident>

<anchor-size> =
width |
height |
block |
inline |
self-block |
self-inline

<calc-product> =
<calc-value> [ [ '*' | / ] <calc-value> ]*

<calc-value> =
<number> |
<dimension> |
<percentage> |
<calc-keyword> |
( <calc-sum> )

<calc-keyword> =
e |
pi |
infinity |
-infinity |
NaN

Exemples

CSS

css
.exemple {
  writing-mode: vertical-rl;
  background-color: yellow;
  block-size: 5%;
  min-block-size: 200px;
}

HTML

html
<p class="exemple">Texte d'exemple</p>

Résultat

Spécifications

Specification
CSS Logical Properties and Values Level 1
# propdef-min-block-size
CSS Box Sizing Module Level 4
# sizing-values

Compatibilité des navigateurs

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

Voir aussi