我如何让下面的两个div在同一行上?(How do I make the lower two divs be on the same line?)

编程入门 行业动态 更新时间:2024-10-28 15:27:47
我如何让下面的两个div在同一行上?(How do I make the lower two divs be on the same line?)

http://jsbin.com/egobu3

我试图放置显示器:内联,但这有缩小div的副作用。 基本上我想要一个宽条,并且下面两个较窄的区域将会是相同的大小。

http://jsbin.com/egobu3

I tried putting display:inline, but this had the side effect of shrinking the divs. Basically I want one wide bar, and two narrower areas below that will together be the same size.

最满意答案

只需将float: left添加到.b和.c 。

.b, .c {float: left}

http://jsbin.com/egobu3/2


或者,将display: inline-block添加到.b和.c :

.b, .c {display:inline-block}

并删除HTML中的空格:

<div class="b">BBBB</div><div class="c">CCCC</div>

http://jsbin.com/egobu3/3

Simply add float: left to .b and .c.

.b, .c {float: left}

http://jsbin.com/egobu3/2


Alternatively, add display: inline-block to .b and .c:

.b, .c {display:inline-block}

And remove the whitespace in the HTML:

<div class="b">BBBB</div><div class="c">CCCC</div>

http://jsbin.com/egobu3/3

更多推荐

本文发布于:2023-08-07 21:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466053.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个   div   line   divs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!