Html 如何根据浏览器加载css?
我为我的项目设计了一个网页,在firefox和chrome中看起来很好,当我查看internet explorer时,图像位置和表格位置都没有正确对齐。 甚至我也尝试导入reset.css文件(eric的最新版本)。这会给出所有页面的不正确对齐表 基于用户代理加载css好吗Html 如何根据浏览器加载css?,html,css,Html,Css,我为我的项目设计了一个网页,在firefox和chrome中看起来很好,当我查看internet explorer时,图像位置和表格位置都没有正确对齐。 甚至我也尝试导入reset.css文件(eric的最新版本)。这会给出所有页面的不正确对齐表 基于用户代理加载css好吗 if ie: <link ....</link> else: <link>...</link> 如果ie: 您可以对IE浏览器使用条件注释。这样
if ie:
<link ....</link>
else:
<link>...</link>
如果ie:
您可以对IE浏览器使用条件注释
。这样写:
<!--[if IE 8]>
<link rel="stylesheet" href="ie8.css"/>
Special instructions for IE 8 here
<![endif]-->
更多信息,请阅读本文
通过使用,您可能会以浏览器为目标。
通过在
页面中添加以下行,您可以定义特定于浏览器的样式表或java脚本文件
适用于IE浏览器
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie.css" />
<![endif]-->
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="css/non-ie.css" />
<!--<![endif]-->
您可能会详细了解到通常可以通过显示解决表格问题。您将支持什么版本的ie?@pKs站点未打开,您应该在end@prash检查一下。萨拉瓦南:看我下面给出的答案。谢谢
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie.css" />
<![endif]-->
<!--[if !IE]><!-->
<link rel="stylesheet" type="text/css" href="css/non-ie.css" />
<!--<![endif]-->
@media screen and (max-width: 699px) and (min-width: 320px) {
div { background: blue; width: 100px; height: 100px; }
}
@media screen and (max-width: 1024px) and (min-width: 700px) {
div { background: green; width: 300px; height: 100px; }
}
@media screen and (max-width: 1280px) and (min-width: 1025px) {
div { background: red; width: 600px; height: 100px; }
}