<div class="flex-container">
<div class="flex-item" style='width:15%'>flex item 1</div>
<div class="flex-item" style='width:15%'>flex item 2</div>
<div class="flex-item" style='width:15%'>flex item 3</div>
</div>
在上面的示例中,我想要使用CSS3 Flexbox在左侧使用Item1,在页面右侧使用第2和第3项。
提前致谢
答案 0 :(得分:10)
https://jsfiddle.net/y9o1utqk/
<div class="flex-container">
<div class="flex-item">flex item 1</div>
<span></span>
<div class="flex-item">flex item 2</div>
<div class="flex-item">flex item 3</div>
</div>
.flex-container{
display:flex;
flex-direction:row;
border:2px blue solid;
}
.flex-container > span{
flex-grow:1;
}
.flex-container > .flex-item{
border:2px red solid;
flex-grow:0;
width:15%;
}
或者:
https://jsfiddle.net/y9o1utqk/1/
<div class="flex-container">
<div class="left">flex item 1</div>
<div class="right">
<div class="flex-item">flex item 2</div>
<div class="flex-item">flex item 3</div>
</div>
</div>
.flex-item{
border:4px red solid;
flex-grow:0;
width:15%;
}
.flex-container{
display:flex;
flex-direction:row;
border:4px blue solid;
justify-content:space-between;
}
.flex-container > .left{
width:15%;
border:4px red solid;
}
.flex-container > .right{
display:flex;
flex-direction:row;
border:4px lime solid;
width:30%;
}
.flex-container > .right > div{
border:4px red solid;
width:50%;
}