Propiedad alignSelf de estilo
Ejemplo
Establezca las alineaciones de uno de los elementos dentro de un elemento flexible para que se ajuste al contenedor:
document.getElementById("myBlueDiv").style.alignSelf = "stretch";
Definición y uso
La propiedad alignSelf especifica la alineación del elemento seleccionado dentro del contenedor flexible.
Nota: La propiedad alignSelf anula la propiedad alignItems del contenedor flexible.
Compatibilidad con navegador
Los números de la tabla especifican la primera versión del navegador que es totalmente compatible con la propiedad.
Los números seguidos de Webkit especifican la primera versión que funcionó con un prefijo.
Property | |||||
---|---|---|---|---|---|
alignSelf | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
Sintaxis
Devuelve la propiedad alignSelf:
object.style.alignSelf
Establezca la propiedad alignSelf:
object.style.alignSelf = "auto|stretch|center|flex-start|flex-end|baseline|initial|inherit"
Valores de propiedad
Value | Description |
---|---|
auto | Default. The element inherits its parent container's align-items property, or "stretch" if it has no parent container |
stretch | The element is positioned to fit the conatiner |
center | The element is positioned at the center of the container |
flex-start | The element is are positioned at the beginning of the container |
flex-end | The element is positioned at the end of the container |
baseline | The element is 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 |
Detalles técnicos
Valor por defecto: | auto |
---|---|
Valor devuelto: | Una cadena, que representa la propiedad align-self de un elemento |
Versión CSS | CSS3 |
páginas relacionadas
Referencia de CSS: propiedad align-self
Referencia HTML DOM STYLE: propiedad alignContent
Referencia HTML DOM STYLE: propiedad alignItems