饥人谷技术博客

flex布局

2017-08-22  本文已影响0人  谨言_慎行

练习flex相关属性用法可以在浏览器开发者工具上练习

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style>
    .boxes{
      width: 300px;
      border: 1px solid;
      display: flex;
    }
    .box1{
      width: 100px;
      height: 200px;
      background-color: red;
      font-size: 32px;
    }
    .box2{
      width: 200px;
      height: 300px;
      background-color: green;
    }
    .box3{
      width: 50px;
      height: 100px;
      background-color: blue;
      font-size: 48px;
    }
  </style>
</head>
<body>
<div class="boxes">
  <div class="box1">1</div>
  <div class="box2">2</div>
  <div class="box3">3</div>
</div>
</body>
</html>

可以设置在容器(.boxes)上的属性

flex-direction
flex-wrap
flex-flow
justify-content
align-items
align-content
image.png image.png image.png image.png

可以设置在容器(.box1,.box2,.box3)上的属性

order
flex-basis
flex-grow
flex-shrink
flex
align-self
image.png image.png
上一篇 下一篇

猜你喜欢

热点阅读