在IE 7上,当指定宽度时,空div将具有高度 [英] on IE 7, empty div will have height when width is specified

查看:85
本文介绍了在IE 7上,当指定宽度时,空div将具有高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎在Firefox和IE上,即使是标准合规模式,

以下代码也会给出不同的结果:

< div style =" border: 1px纯橙色;宽度:300px">< / div>

IE 7上的
,div的高度为line-height,但在Firefox上

2,div的高度为零。


当宽度:300px被删除时,它在IE 7上的高度为零*
和Firefox 2 ...


任何使它们保持一致的方法?当

数据库在div中返回空字符串时,需要零高度。非常感谢!

it seems that on Firefox and IE, even for standard compliance mode,
the following code will give different result:
<div style="border:1px solid orange; width:300px"></div>

on IE 7, the div will have a height of "line-height", but on Firefox
2, the div will have zero height.

When the width:300px is removed, then it is zero height on both IE 7
and Firefox 2...

any method to make them consistent? Zero height is wanted when the
database returns empty string for within the div. Thanks very much!

推荐答案

2008年6月5日星期四22:14:31 -0700(PDT),/ liketofindoutwhy /:
Thu, 5 Jun 2008 22:14:31 -0700 (PDT), /liketofindoutwhy/:

似乎在Firefox和IE上,即使是标准合规模式,

以下代码也会给出不同的结果:


< div style =" border:1px solid orange;宽度:300px">< / div>

IE 7上的
,div的高度为line-height,但在Firefox上

2,div的高度为零。


当宽度:300px被删除时,它在IE 7上的高度为零*
和Firefox 2 ...


任何使它们保持一致的方法?当

数据库在div中返回空字符串时,需要零高度。非常感谢!
it seems that on Firefox and IE, even for standard compliance mode,
the following code will give different result:

<div style="border:1px solid orange; width:300px"></div>

on IE 7, the div will have a height of "line-height", but on Firefox
2, the div will have zero height.

When the width:300px is removed, then it is zero height on both IE 7
and Firefox 2...

any method to make them consistent? Zero height is wanted when the
database returns empty string for within the div. Thanks very much!



给DIV一个明确的''宽度''触发IE中的''hasLayout''[1]

属性渲染完全不同于

标准兼容。


[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx


-

Stanimir

Giving the DIV an explicit ''width'' triggers its ''hasLayout'' [1]
property in IE which makes it render quite differently from
standard-compliant.

[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx

--
Stanimir


文章< g2 ***** *****@registered.motzarella.org>,

Stanimir Stamenkov< s7 **** @ netscape.netwrote:

In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:


给DIV一个明确的''宽度''触发IE中的''hasLayout''[1]

属性,这使得它与
$ b $完全不同b符合标准。


[1] http://msdn.microsoft.com/en-us/libr...76( VS.85).aspx



这个网址在Safari 2和iCab 4中没有滚动条显示。


-

dorayme

This url appears without scrollbars in Safari 2 and iCab 4.

--
dorayme


星期五,06六月2008 16:08:47 +1000,/ dorayme /:
Fri, 06 Jun 2008 16:08:47 +1000, /dorayme/:

文章< g2 ********** @ registered.motzarella.org>,

Stanimir Stamenkov< s7 **** @ netscape.netwrote:
In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:

>给DIV一个明确的''宽度''触发它在IE中的''hasLayout''[1]
属性,这使它渲染得相当不同于符合标准的。

[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx



这个网址在Safari 2和iCab 4中没有滚动条显示。


This url appears without scrollbars in Safari 2 and iCab 4.



我不知道Safari 2和iCab 4的年龄有多大以及它们是否可以

转为autho r风格关闭,但考虑到OP有IE试试他将会b / b
能够阅读它。我正在使用SeaMonkey 1.1.9,

Opera 9.27,Safari 3.1.1和Lynx 2.8.6rel.5在Windows上阅读它。


-

Stanimir

I don''t know how old Safari 2 and iCab 4 are and whether they could
turn author styles off, but given the OP has IE to try with he''ll be
able to read it. I''m reading it all right using SeaMonkey 1.1.9,
Opera 9.27, Safari 3.1.1 and Lynx 2.8.6rel.5 all on Windows.

--
Stanimir


这篇关于在IE 7上,当指定宽度时,空div将具有高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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