Home  >  Article  >  Web Front-end  >  有个问题求解_html/css_WEB-ITnose

有个问题求解_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:17:44892browse

					<div style="width:100%;height:29px;font-family:宋体;font-size:14px">						123456					</div>					<div style="width:100%;height:1px;background-color:#000">					</div>					<div style="width:100%;height:29px;font-family:宋体;font-size:14px">						123456					</div>

中间那个高度为1像素的div为什么在IE8中高度变成了18像素  有知道的朋友麻烦告诉下
或者能够解决ie和chrome浏览器border的差异 
ie边框=长*宽
其它=长*宽+border


回复讨论(解决方案)

使用css hack啊,不同浏览器对个别属性支持不一样,那就针对个别属性来设置啊

因为 IE有个默认的高度,设置overflow:hidden即可。。

<div style="width:100%;height:29px;font-family:宋体;font-size:14px">    123456</div><div style="width:100%;height:1px;background-color:#000;overflow:hidden"></div><div style="width:100%;height:29px;font-family:宋体;font-size:14px">    123456</div>

。。比版主晚了一步,我刚刚自己在试
确实是加上这个
overflow:hidden;

我2了,没看回复就自己 试去了。。。

因为IE有个默认的高度,设置overflow:hidden即可。。

XML/HTML code?12345678

    123456

版主你好,还想请教一个问题,怎么解决FF和IE之间Border差异的问题呢 
在IE里面border是占用div的width和height的
在Chrome里面border是不占用div的width和height的
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn