【问题标题】:Internet Explorer not rendering the leading text in a custom list itemInternet Explorer 未呈现自定义列表项中的前导文本
【发布时间】:2014-11-03 07:23:14
【问题描述】:

这是How to create a custom list style with a dash的后续行动。

具体来说,我的问题涉及 Internet Explorer 9(请参阅本问题末尾的示例 XHTML 文档。我的示例文档包含内联 CSS。)

当我以本地文件的形式查看我的示例 XHTML 文档时,我在 IE9 中看到了预期的结果:

Here is a list:
- One
- Two
- Three

然而,当我通过 IIS 查看同一个 XHTML 文档时,我在 IE9 中看到了一些不同:

Here is a list:
  One
  Two
  Three

也就是说,IE9 不呈现破折号,它打算出现在每个列表项的开头。

(请注意,Firefox 31 在本地以及通过 IIS 查看文件时呈现破折号。)

这个问题是否与 IIS 返回的 HTTP 标头有关?以下是我的 IIS 实例返回的关键标头:

200 OK
Date: Tue, 09 Sep 2014 18:41:34 GMT
Server: Microsoft-IIS/7.5
Content-Length: 706
Content-Type: text/html
Title: Custom List Item Test
X-Powered-By: ASP.NET

XHTML 文档示例:

<!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" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Custom List Item Test</title>

    <!-- https://stackoverflow.com/a/24279072/1497596 -->
    <style type="text/css">
      ul
      {
        list-style-type: none;
      }

      ul > li:before
      {
        content: "-";
        position: absolute;
        margin-left: -1.1em;
      }
    </style>
  </head>
  <body>
    <h1>Here is a list:</h1>
    <ul>
      <li>One</li>
      <li>Two</li>
      <li>Three</li>
    </ul>
  </body>
</html>

【问题讨论】:

标签: css internet-explorer iis xhtml html-lists


【解决方案1】:

@Mr Lister,您的评论为我指明了解决方案。

发现我的IE9Compatibility View设置如下:

[x] Include updated website lists from Microsoft
[x] Display intranet sites in Compatibility View
[ ] Display all websites in Compatibility View

IIS 在我的Intranet 成员服务器上提供我感兴趣的网页。由于第二个复选框被选中,IE9 使用兼容性视图设置呈现页面。清除第二个复选框后,介绍每个列表项的破折号变得可见。

使用我上面显示的设置,当我从我的本地磁盘查看文档时,IE9 最初确实显示列表项破折号。但是,当我选中第三个复选框时,破折号从列表中消失了。

因此,这解释了我在本地查看文档与通过 IIS 查看文档时观察到的不同结果。

【讨论】:

    猜你喜欢
    • 2015-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2016-11-22
    • 2012-02-02
    • 2011-01-14
    相关资源
    最近更新 更多