Latest web development tutorials

HTML DOM Style flexBasis property

Style Object Reference Style Objects

Examples

The initial length of the project is to set up a flexible 200 pixels:

document.getElementById("myBlueDiv").style.flexBasis="200px";

try it"

Definition and Usage

flexBasis attribute specifies the initial length of the flexible project.

Note: If theelement is not flexible items, flexBasis property does not work.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Firefox, Opera and Chrome support flexBasis property.


grammar

Back flexBasis properties:

object .style.flexBasis

Setting flexBasis properties:

object .style.flexBasis="number|auto|initial|inherit"

Property Value

描述
number 一个长度单位或者一个百分比,规定灵活项目的初始长度。
auto 默认值。长度等于灵活项目的长度。如果该项目未指定长度,则长度将根据内容决定。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: auto
return value: String representing the flex-basis attribute element.
CSS version CSS3


related articles

CSS Reference Manual: Flex-Basis property

HTML DOM STYLE Reference: Flex Properties

HTML DOM STYLE Reference: flexDirection property

HTML DOM STYLE Reference: FlexFlow property

HTML DOM STYLE Reference: flexGrow property

HTML DOM STYLE Reference: flexShrink property

HTML DOM STYLE Reference: flexWrap property


Style Object Reference Style Objects