美文网首页
flex布局(转载阮一峰)

flex布局(转载阮一峰)

作者: dshd | 来源:发表于2018-10-03 20:24 被阅读0次

<div class="first-face">

  <span class="pip"></span>

</div>

<div class="second-face">

  <span class="pip"></span>

  <span class="pip"></span>

</div>

<div class="third-face">

  <span class="pip"></span>

  <span class="pip"></span>

  <span class="pip"></span>

</div>

<div class="fourth-face">

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

</div>

<div class="fifth-face">

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

  <div class="column">

    <span class="pip"></span>

  </div>

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

</div>

<div class="sixth-face">

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

  <div class="column">

    <span class="pip"></span>

    <span class="pip"></span>

    <span class="pip"></span>

  </div>

</div>

.first-face {

  display: flex;

  align-items: flex-end;

  justify-content: flex-end;

}

.second-face {

  display: flex;

  justify-content:space-between;

}

.second-face .pip:nth-of-type(2) {

  align-self: flex-end;

}

.third-face {

  display: flex;

  justify-content: space-between;

}

.third-face .pip:nth-of-type(2) {

  align-self: center;

}

.third-face .pip:nth-of-type(3) {

  align-self: flex-end;

}

.fourth-face, .sixth-face {

  display: flex;

  justify-content: space-between;

}

.fourth-face .column, .sixth-face .column {

  display: flex;

  flex-direction: column;

  justify-content: space-between;

}

.fifth-face {

  display: flex;

  justify-content: space-between;

}

.fifth-face .column {

  display: flex;

  flex-direction: column;

  justify-content: space-between;

}

.fifth-face .column:nth-of-type(2) {

  justify-content: center;

}

/* OTHER STYLES */

* {

  box-sizing: border-box;

}

html, body {

  height: 100%;

}

body {

  display: flex;

  align-items: center;

  justify-content: center;

  vertical-align: center;

  flex-wrap: wrap;

  align-content: center;

  font-family: 'Open Sans', sans-serif;

  background: linear-gradient(top, #222, #333);

}

[class$="face"] {

  margin: 16px;

  padding: 4px;

  background-color: #e7e7e7;

  width: 104px;

  height: 104px;

  object-fit: contain;

  box-shadow:

    inset 0 5px white,

    inset 0 -5px #bbb,

    inset 5px 0 #d7d7d7,

    inset -5px 0 #d7d7d7;

  border-radius: 10%;

}

.pip {

  display: block;

  width: 24px;

  height: 24px;

  border-radius: 50%;

  margin: 4px;

  background-color: #333;

  box-shadow: inset 0 3px #111, inset 0 -3px #555;

}

flex实现骰子布局

相关文章

  • Flex布局

    转载自 阮一峰Flex 布局教程:语法篇Flex 布局教程:实例篇

  • Flex

    阮一峰-Flex布局 阮一峰-Flex布局实例教程 Flex布局 块级元素 行内元素 注意,设为 Flex 布局...

  • 【学习资料整理】30分钟掌握Flex布局

    了解flex基本语法阮一峰——Flex 布局教程:语法篇 flex实例布局阮一峰——Flex 布局教程:实例篇 f...

  • 阮一峰CSS flex -弹性布局

    阮一峰CSS flex 布局教程 Flex 布局教程:实例篇

  • Flex从0-春风

    Flex例子阮一峰Flex布局教程 语法篇

  • flex布局(转载阮一峰)

    .first-face { display: fle...

  • Flex学习总结思维导图

    示例配图来自阮一峰的Flex教程 参考 阮一峰-Flex 布局教程[https://www.ruanyifeng....

  • flex布局

    具体参考阮一峰博客 Flex 布局教程:语法篇Flex 布局教程:实例篇

  • css布局学习--flex布局

    flex布局 项目概念及例子摘自阮一峰Flex 布局教程 flex分为容器(flex container)和容器项...

  • flex盒模型-语法

    转载:Flex 布局教程:语法篇 --- 阮一峰的网络日志 网页布局(layout)是 CSS 的一个重点应用。 ...

网友评论

      本文标题:flex布局(转载阮一峰)

      本文链接:https://www.haomeiwen.com/subject/haktaftx.html