css3 - 关于flex布局的一个问题
怪我咯
怪我咯 2017-04-17 11:57:19
0
2
540
<p class="box dice1">
    <span></span>
</p>
<p class="box dice2">
    <span></span>
    <span></span>
</p>



    * {
    padding: 0;
    margin: 0;
}

span {
    display: inline-block;
    width: 100px;
    height: 100px;
    border-radius:  50px;
    background-color: #000;
    margin: 10px;
}

.box {
    display: inline-flex;
    width: 360px;
    height: 360px;
    border: 2px solid #000;
    border-radius: 15px;
}

.dice1 {
    flex-flow: row wrap;
    justify-content: center;
}

.dice2 {
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center
}



问题>>>>>>>>>>怎么保证这两个骰子不变的情况下,让他们对齐,不要一个低一个高

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
PHPzhong

Put another layer of

on the outside of p, and then set the outermost layer of p to flex.

Like this:

<p class="body">
  // ..
</p>

Add this paragraph to css:

p.body {
  display: flex;
}
巴扎黑
<p class="box-center-v">
  <p class="child box-flex">文字一</p>
   <p class="child box-flex">文字二</p>
</p>
*{
  margin:0;
  padding:0
}
.box-center-v {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    -webkit-align-items: center;
    align-items: center
}
.box-flex {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
    width: 100%;
    overflow: hidden;
}
.child{
  margin:10px;
  line-height:50px;
  border:3px solid #666;
  text-align:center
}

demo

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template