首页htmlflexCSS Layout - 如何使用flex-grow和flex-shrink以固定的flex-basis创建flex box

CSS Layout - 如何使用flex-grow和flex-shrink以固定的flex-basis创建flex box

我们想知道如何使用flex-grow和flex-shrink以固定的flex-basis创建flex box。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.child {
  padding: 10px;
  margin: 10px;
  background-color: #eee;
}

.container {
  padding: 10px;
  background-color: yellow;
  display: -webkit-flex;
  display: flex;
}

.child.one {
  -webkit-flex: 5 1 200px;
  flex: 5 1 200px;
  color: green;
}

.child.two {
  -webkit-flex: 1 3 200px;
  flex: 1 3 200px;
  color: purple;
}
</style>

</head>
<body>
  <div class="container">
    <div class="child one">
      Child One<br>Lorem ipsum<br>dolor sit amet<br>This is
      a bit longer line
    </div>
    <div class="child two">Two</div>
  </div>
</body>
</html>