CSS3 box-flex property
Example
Define two flexible p elements. If the total width of the parent box is 300px, #p1 will have a width of 100px and p2 will have a width of 200px:
#p1
{
moz-box-flex:
1.0
;
/*
Firefox
*/
webkit-box-flex:
1.0
;
/*
Safari and Chrome
*/
ms-flex:
1.0
;
/*
Internet Explorer 10
*/
box-flex:
1.0
;
border:
1
px
solid
red
;
}
#p2
{
moz-box-flex:
2.0
;
/*
Firefox
*/
webkit-box-flex:
2.0
;
/*
Safari and Chrome
*/
ms-flex:
2.0
;
/*
Internet Explorer 10
*/
box-flex:
2.0
;
border:
1
px
solid
blue
;
}
Try it »
Browser support





Currently no browser supports the box-flex property.
Firefox supports the alternative -moz-box-flex property.
Safari, Opera, and Chrome support the alternative -webkit-box-flex property.
Property definition and usage
The box-flex property is non-standard and is not recommended.
The box-flex property specifies whether the child elements of a box are flexible or fixed in size.
Tip: Whether the element shrinks or grows flexibly as the box shrinks and grows. Whenever there is extra space in the box, the element expands flexibly to fill that space.
| Default value: | 0.0 (indicates the element is not flexible) |
|---|---|
| Inherited: | no |
| Version: | CSS3 |
| JavaScript syntax: | object.style.boxFlex=2.0 |
Syntax
box-flex:
value
;
| Value | Description |
|---|---|
| value | The flexibility of the element. All flex values are relative |