有没有办法让“换行"?在div之间? [英] Is there a way to have a "Line Break" between divs?
本文介绍了有没有办法让“换行"?在div之间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有一个菜单,4 个菜单点,我想把它们放在一个 2x2 的正方形中.有没有办法做到这一点,而无需为前两个课程设置课程,为其他课程设置一个课程?
So I have a menu, 4 menu points and I want to put them in a square 2x2. Is there a way to do that WITHOUT having a class for the first two and one for the other ones?
感谢您的帮助:)
更新:我确实有点乱,我正在使用弹性框结构,很抱歉没有发布此信息:
UPDATE: I did mess around a little more and I'm using the flex box structure, I'm sorry for not posting this information:
ul {
-webkit-box-orient: horizontal;
}
ul li {
-webkit-box-flex: 1;
height: 44%;
margin: 3%;
}
推荐答案
好的.一方面,您可以使用浮动并相应地设置宽度.请参阅下面的示例,或查看 http://jsfiddle.net/BUPX7/ 以获取实时示例.
Sure. For one, you can use floating and set the widths accordingly. See the example below, or http://jsfiddle.net/BUPX7/ for a live example.
HTML
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
CSS
ul {
width: 200px;
}
ul li {
width: 100px;
margin: 0;
padding: 0;
float: left;
}
这篇关于有没有办法让“换行"?在div之间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文