<em id="09ttv"></em>
    <sup id="09ttv"><pre id="09ttv"></pre></sup>
    <dd id="09ttv"></dd>

        • Flex布局-骰子demo

          2018-4-20    seo達人

          如果您想訂閱本博客內(nèi)容,每天自動發(fā)到您的郵箱中, 請點這里

          最近學習了Flex布局,

          以下是阮一峰老師關(guān)于Flex的博客  。在此感謝他讓我get一項新技能!

          Flex語法篇:http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html

          Flex實戰(zhàn)篇:http://www.ruanyifeng.com/blog/2015/07/flex-examples.html

          1、色子數(shù):1

          思路:讓圓點(即子元素)在橫軸上居中在豎軸上居中,分別用justify-content和align-items

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 200px;  height: 200px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 25px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  justify-content: center;  align-items:center;  }  .main >div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="item"></div>
          </div>
          </body>
          </html>
          2、色子數(shù):2

          思路:豎列布局且在主軸方向采用justify-content的兩端對齊布局,這樣兩個圓點會在左邊呈現(xiàn),然后采用align-items讓其居中

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 200px;  height: 200px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 25px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  flex-direction: column;  justify-content: space-between;  align-items:center;  }  .main >div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="item"></div>
              <div class="item"></div>
          </div>
          </body>
          </html>
          3、色子數(shù):3

          思路:用到align-self屬性讓第二個和第三個圓點有自己的屬性設(shè)置,分別在縱軸方向上居中和低端對齊

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 180px;  height: 180px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 25px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  }  .main >div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  .item:nth-child(2){  align-self:center;  }  .item:nth-child(3){  align-self:flex-end;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="item"></div>
              <div class="item"></div>
              <div class="item"></div>
          </div>
          </body>
          </html>
          4、色子數(shù):4

          思路:先豎著放兩行圓點,每行圓點里橫著放兩個圓點,所以最外層父元素設(shè)置align,里面的父元素設(shè)置justify-content

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 180px;  height: 180px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 25px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  flex-wrap:wrap;  align-content:space-between;  }  .column >div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  .column{  flex-basis:100%;  display:flex;  justify-content: space-between;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
          </div>
          </body>
          </html>
          5、色子數(shù):5

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 180px;  height: 180px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 25px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  flex-wrap:wrap;  align-content:space-between;  }  .column > div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  .column{  flex-basis:100%;  display:flex;  justify-content: space-between;  }  .column:nth-child(2){  justify-content: center;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
              <div class="column">
              <div class="item"></div>
              </div>
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
          </div>
          </body>
          </html>
          6、色子數(shù):6

          思路:跟四點的一樣,先豎放三行在每行橫放兩個圓點

          實現(xiàn)代碼:

          <!DOCTYPE html>
          <html>
          <head lang="en">
              <meta charset="UTF-8">
              <title></title>
              <style> *{  margin:0;  padding:0;  }  body{  background:#000;  }  .main {  width: 180px;  height: 180px;  background: #fff;  border-radius: 20px;  margin: 100px auto;  padding: 15px;  -webkit-box-sizing: border-box;  -moz-box-sizing: border-box;  box-sizing: border-box;  display: flex;  align-content:space-between;  flex-wrap:wrap;  }  .column > div{  width:40px;  height:40px;  background:#000;  border-radius:40px;  }  .column{  flex-basis:100%;  display:flex;  justify-content: space-between;  }  </style>
          </head>
          <body>
          <div class="main">
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
              <div class="column">
                  <div class="item"></div>
                  <div class="item"></div>
              </div>
          
          </div>
          </body>
          </html>

          藍藍設(shè)計m.sdgs6788.com )是一家專注而深入的界面設(shè)計公司,為期望卓越的國內(nèi)外企業(yè)提供卓越的UI界面設(shè)計、BS界面設(shè)計 、 cs界面設(shè)計 、 ipad界面設(shè)計 、 包裝設(shè)計 、 圖標定制 、 用戶體驗 、交互設(shè)計、 網(wǎng)站建設(shè) 平面設(shè)計服務(wù)

          日歷

          鏈接

          個人資料

          藍藍設(shè)計的小編 http://m.sdgs6788.com

          存檔

          午夜精品久久久内射近拍高清| 久久人人爽人人爽人人片AV不| 99久久夜色精品国产网站| 亚洲国产精品一区二区久久| 精品久久人人爽天天玩人人妻| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 亚洲国产精品成人久久蜜臀| 久久综合色老色| 99久久免费只有精品国产| 久久久久波多野结衣高潮| 中文字幕久久欲求不满| 亚洲国产精品成人久久| 久久97久久97精品免视看| 午夜天堂精品久久久久| 欧美激情精品久久久久久久九九九| 色综合久久无码中文字幕| 久久久国产精品| 亚洲国产精品久久久久| 婷婷伊人久久大香线蕉AV| 一极黄色视频久久网站| 国产精品一区二区久久| 亚洲精品tv久久久久久久久| 久久夜色精品国产www| 99久久婷婷国产综合精品草原| 久久九九精品99国产精品| 久久国产AVJUST麻豆| 国产农村妇女毛片精品久久| 国产一区二区三区久久| a高清免费毛片久久| 久久婷婷成人综合色综合| 久久综合亚洲色HEZYO社区| 久久性生大片免费观看性| 91精品国产高清久久久久久国产嫩草 | 成人精品一区二区久久久| 久久久久久九九99精品| 久久久久亚洲AV成人片| 亚洲AV无码久久| 久久精品人人做人人爽97| 国产国产成人精品久久| 88久久精品无码一区二区毛片| 亚洲国产精品热久久|