column-count
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
La propiedad CSS column-count
divide el contenido de un elemento en el número de columnas indicado.
Pruébalo
column-count: 2;
column-count: 3;
column-count: 4;
column-count: auto;
column-width: 8rem;
<section id="default-example">
<p id="example-element">
London. Michaelmas term lately over, and the Lord Chancellor sitting in
Lincoln's Inn Hall. Implacable November weather. As much mud in the streets
as if the waters had but newly retired from the face of the earth, and it
would not be wonderful to meet a Megalosaurus, forty feet long or so,
waddling like an elephantine lizard up Holborn Hill.
</p>
</section>
#example-element {
width: 100%;
text-align: left;
}
Sintaxis
/* Keyword value */
column-count: auto;
/* <integer> value */
column-count: 3;
/* Global values */
column-count: inherit;
column-count: initial;
column-count: unset;
Valores
auto
-
El número de columnas es determinado por otras propiedades CSS, como
column-width
. <integer>
-
Es un
<integer>
estrictamente positivo que describe el número ideal de columnas en las que el contenido del elemento va a fluir. Si la propiedadcolumn-width
se establece a un valor que no seaauto
, se limitará a indicar el número máximo permitido de columnas.
Sintaxis formal
column-count =
auto |
<integer [1,∞]>
Ejemplos
HTML
<p class="content-box">
This is a bunch of text split into three columns using the CSS `column-count`
property. The text is equally distributed over the columns.
</p>
CSS
.content-box {
column-count: 3;
}
Resultado
Especificaciones
Specification |
---|
CSS Multi-column Layout Module Level 1 # cc |