Vlastnost Styl alignItems
Příklad
Umístěte zarovnání pro všechny položky flexibilního prvku <div> na začátek kontejneru:
document.getElementById("main").style.alignItems = "flex-start";
Definice a použití
Vlastnost alignItems 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í vlastnosti align-items.
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která plně podporuje vlastnost.
Čísla následovaná Webkitem určují první verzi, která pracovala s předponou.
Property | |||||
---|---|---|---|---|---|
alignItems | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
Syntax
Vraťte vlastnost alignItems:
object.style.alignItems
Nastavte vlastnost alignItems:
object.style.alignItems = "stretch|center|flex-start|flex-end|baseline|initial|inherit"
Hodnoty vlastností
Value | Description |
---|---|
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 |
Technické údaje
Výchozí hodnota: | protáhnout se |
---|---|
Návratová hodnota: | Řetězec představující vlastnost align-items prvku |
Verze CSS | CSS3 |
Související stránky
CSS reference: vlastnost align-items
Odkaz na STYL DOM HTML: vlastnost alignContent
Odkaz na STYL DOM HTML: vlastnost alignSelf