两个50%宽度divs之间的差距 [英] gap between two 50% width divs

查看:110
本文介绍了两个50%宽度divs之间的差距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个宽度为181px的容器< div> 我有两个孩子< div> 元素在我的容器div中,每个元素的宽度都是50%。 我的问题是每个我的孩子< div> 元素的宽度仅为90px,导致两者之间的间距为1px。 $ b

任何建议消除差距?

解决方案

设置一个 div 50%,另一个可以使用标准块的行为来消耗宽度的其余部分:

 < div style =width:181px;> 
< div style =width:50%; float:left;>< / div>
< div>< / div>
< / div>


I have a container <div> with a width of 181px.

I have two child <div> elements in my container div each with a width of 50%.

My problem is that each of my child <div> elements has a width of only 90px, resulting in a 1px gap between the two.

Any suggestions for removing the gap?

解决方案

Set the width of one div as 50% and the other can use the standard block behavior of consuming the rest of the width:

<div style="width: 181px;">
    <div style="width: 50%; float: left;"></div>
    <div></div>
</div>

这篇关于两个50%宽度divs之间的差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆