Vlastnost CSS align-items
Příklad
Vycentrujte zarovnání pro všechny položky flexibilního prvku <div>:
div
{
display: flex;
align-items: center;
}
Definice a použití
Vlastnost align-items
určuje výchozí zarovnání pro položky uvnitř flexibilního kontejneru.
Tip: Použijte vlastnost align-self každé položky k přepsání align-items
vlastnosti.
Výchozí hodnota: | protáhnout se |
---|---|
Zděděno: | Ne |
Animovatelné: | Ne. Přečtěte si o tématu Animable |
Verze: | CSS3 |
Syntaxe JavaScriptu: | objekt .style.alignItems="center" |
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která plně podporuje vlastnost.
Čísla následovaná -webkit- určují první verzi, která pracovala s předponou.
Property | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
Syntaxe CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Hodnoty vlastností
Value | Description | Play it |
---|---|---|
stretch | Default. Items are stretched to fit the container | |
center | Items are positioned at the center of the container | |
flex-start | Items are positioned at the beginning of the container | |
flex-end | Items are positioned at the end of the container | |
baseline | Items are positioned at the baseline of the container | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Související stránky
CSS reference: vlastnost align-content
CSS reference: vlastnost align-self
Odkaz HTML DOM: vlastnost alignItems