Estilo justifique a propriedade de conteúdo
Exemplo
Deixe algum espaço entre os itens do elemento flexível <div>:
document.getElementById("main").style.justifyContent = "space-between";
Definição e uso
A propriedade justifyContent alinha os itens do container flexível quando os itens não utilizam todo o espaço disponível no eixo principal (horizontal).
Dica: Use a propriedade alignContent para alinhar os itens no eixo cruzado (verticalmente).
Suporte ao navegador
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Sintaxe
Retorne a propriedade justifyContent:
object.style.justifyContent
Defina a propriedade justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Valores de propriedade
Value | Description |
---|---|
flex-start | Default value. Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
center | Items are positioned at the center of the container |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalhes técnicos
Valor padrão: | início flexível |
---|---|
Valor de retorno: | Uma String, representando a propriedade justify-content de um elemento |
Versão CSS | CSS3 |
Páginas relacionadas
Referência CSS: propriedade justify-content
Referência HTML DOM STYLE: propriedade alignContent
Referência HTML DOM STYLE: propriedade alignItems
Referência HTML DOM STYLE: propriedade alignSelf
❮ Objeto de estilo