代码示例:(标识:cssref_flex-basis)
<!DOCTYPE html>
<html>
<head>
<style>
#main {
  width: 300px;
  height: 100px;
  border: 1px solid #c3c3c3;
  display: flex;
}

#main div {
  flex-grow: 0;
  flex-shrink: 0;
  flex-basis: 50px;
}

#main div:nth-of-type(2) {
  flex-basis: 100px;
}
</style>
</head>
<body>

<h1>flex-basis 属性</h1>

<p>将弹性项目的初始长度设置为 50 像素;例外是,将第二个弹性项目的初始长度设置为 100 像素:</p>

<div id="main">
  <div style="background-color:coral;">50px</div>
  <div style="background-color:lightblue;">100px</div>
  <div style="background-color:khaki;">50px</div>
  <div style="background-color:pink;">50px</div>
  <div style="background-color:lightgrey;">50px</div>
</div>

<p><b>注释:</b>Internet Explorer 10 以及更早的版本不支持 flex-basis 属性。</p>

</body>
</html>
运行结果: