[英]how to give two heights to DIV (one for IE and second for other browsers)
在CSS文件中,是否有一种方法可以为仅适用于Internet Explorer的DIV提供特定高度,同时为相同的DIV提供适用于除Internet Explorer之外的所有浏览器的另一个高度?
You can create an IE-specific stylesheet and use IE Conditional statements. 您可以创建特定于IE的样式表并使用IE条件语句。
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
This way, you basically have two stylesheets; 这样,你基本上有两个样式表; one for IE and other for rest of the standard-compliant browsers.
一个用于IE,另一个用于其他符合标准的浏览器。
Hacks could have been used such as: 可以使用黑客 ,例如:
_height:500px;
*height:500px;
But that is not recommended. 但不建议这样做。
See Also: 也可以看看:
I have used the following and it worked in IE8. 我使用了以下内容,它在IE8中运行。 Put the following code within tag.
将以下代码放在标记中。
You can watch the online version from here, http://nazmulweb.com/site5/demo/iecss/ 您可以在此处观看在线版本, http://nazmulweb.com/site5/demo/iecss/
<style type="text/css">
#tgtDiv
{
height: 300px;
width: 400px;
border: 1px solid green;
}
</style>
<!--[if IE]>
<style type="text/css">
#tgtDiv
{
height: 300px;
width: 400px;
border: 5px solid red;
}
</style>
<![endif]-->
try this 试试这个
<style>
#mydiv { height:800px; }
</style>
<!--[if IE]>
<style>
#mydiv { height:500px; }
</style>
<![endif]-->
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.