所有
告诉我如何对元素进行编程,这样当你改变屏幕尺寸时,元素的一部分被放置在几行中,而另一部分则被放置在一行中
两种情况: https://s13.postimg.org/pswl5sfjr/example.png
html示例: https://jsfiddle.net/ehuoy97d/
<div class = "menu">
<div class = "menu-border"></div>
<div class = "menu-items-storage">
<div class = "menu-item">#1</div>
<div class = "menu-item">#2</div>
<div class = "menu-item">#3</div>
<div class = "menu-item">#4</div>
</div>
<div class = "menu-border"></div>
</div>
.menu {
width: 100%;
background-color: #ffe0e0;
font-size: 0px;
}
.menu .menu-border {
display: inline-block;
width: 75px;
height: 30px;
background: #bb0000;
}
.menu .menu-items-storage {
display: inline-block;
}
.menu .menu-item {
display: inline-block;
width: 30px;
height: 30px;
margin: 0px 10px;
padding: 0px;
font-size: 16px;
border: 2px solid #80ff80;
background-color: #e0ffe0;
}
答案 0 :(得分:1)
如果我理解正确,就像这样? See this fiddle
.menu .menu-items-storage {
display: inline-block;
width: 30%;
}
答案 1 :(得分:0)