【问题标题】:How does Internet Explorer 8 support the CSS outline attribute?Internet Explorer 8 如何支持 CSS 大纲属性?
【发布时间】:2009-10-08 22:21:53
【问题描述】:

website 表示支持,但无法呈现以下样式。


    <style type="text/css">
        a[href="#"]{outline:#f00 dotted 2px !important}
    </style>

但是,以下将呈现


    <style type="text/css">
        a[href="#"]{border:#f00 dotted 2px !important}
    </style>

这是我的文件


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <title>...</title>
   <link type="text/css" rel="stylesheet" href="../content/style.css" />

</head>
<body>...</body>
</html>

【问题讨论】:

  • 您确定该规则得到应用吗?我认为 IE8 确实支持属性选择器 (quirksmode.org/css/contents.html),但这值得一试。
  • 它仅在标准模式下受支持...您的页面处于哪种渲染模式?

标签: css internet-explorer-8


【解决方案1】:

检查 IE8 是否以兼容模式呈现。如果您的标题中有以下内容,则大纲将不起作用:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >

如果您的 doctype 标签不正确,IE8 也将默认为 quirks 模式,因此也要验证这一点。另外,如果您使用的是 IIS,服务器可能会强制使用 IE7 兼容模式。

【讨论】:

  • 我已将文档的开头添加到原始问题中。它是 xhtml 1.0 严格的,并且可以验证
  • 就是这样,我打开了兼容模式
【解决方案2】:

可能是因为链接在浏览器中没有显示为#,而是yourpage.html#

尝试使用 end-with 代替:

<style type="text/css">
    a[href$="#"]{outline:#f00 dotted 2px !important}
</style>

【讨论】:

  • 边框与轮廓不同。他只是指出他使用的选择器是为他的目的而工作的。
猜你喜欢
  • 2012-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-03
  • 1970-01-01
  • 1970-01-01
  • 2018-07-04
  • 1970-01-01
相关资源
最近更新 更多