html - 将 IF 语句放在 HTML 页面的什么位置?

标签 html css internet-explorer-7 internet-explorer-6

我试图让我的网站在 ie6 和 ie7 上正常显示,他们说你必须使用这个声明:

 <!--[if IE 6]> <link href="ie6.css" rel="stylesheet" type="text/css"> <![endif]-->

现在我应该把这条语句放在我的 HTML 页面的什么地方?


编辑:

所以我在文档类型之后添加了这个:

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org
  /TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <!--[if lt IE 7]><html class="ie6" lang="en"><![endif]-->
  <!--[if IE 7]><html class="ie7" lang="en"><![endif]-->
  <!--[if IE 8]><html class="ie8" lang="en"><![endif]-->
  <!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
  <head>

在我的样式表 ie6.css 中我有这个:

.ie6 #magazine_style_left {
position:relative;
float:left;
width:150px;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:14px;
color:#999999;
font-style:italic;
line-height:18px;

}

.ie6 #magazine_style_right {
position:relative;
float:right;
width:519px;
border-left: 1px solid #F2F2F2;
}

我已经在同一页面上添加了 CSS,但它仍然无法正常工作。它就像它没有拿起/使用 ie6 css

最佳答案

在head标签内

<head>
<!--[if IE 6]> <link href="ie6.css" rel="stylesheet" type="text/css"> <![endif]-->
</head>

关于html - 将 IF 语句放在 HTML 页面的什么位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8500674/

相关文章:

html - Flexbox - 根据元素总数设置 flex 元素大小

javascript - 从 onclick 事件中选择具有类名的前一个 div 并添加到它的类

css - 我的 CSS 导航中的下拉菜单没有显示在正确的位置

html - 如何将 div 的动态列表排列成 2 列

css - 在网站上设置字体大小的当前标准是什么?

html - IE 7/8 CSS 菜单问题

css - 水平滚动条仅在 IE7 中出现,即使溢出 :hidden being set

css - 为什么我的背景图片无法在 IE7 中正确显示?

javascript - 为什么 document.getElementById 在页面中获取多个 iframe 时返回 null

javascript - HTML:如何制作镂空排版?