有序列表不适用于IE7(< ol>< li) [英] ordered list does not work on IE7 (<ol><li)

查看:77
本文介绍了有序列表不适用于IE7(< ol>< li)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在IE7上创建一个有序列表,但由于某些原因无法正常工作. 有人知道为什么会这样吗? 更新

I am trying to create an ordered list on IE7 but for some reason does not work. Does anybody knows why this can be? Update

问题是我看不到数字,谢谢.

The issue is that I cant see the numbers, thanks.

谢谢.

例如

<ol>
 <li></li>
 <li><li>
</ol>

更新 作为示例,我看到了此页面,如果您在IE7上查看该页面,您将看不到数字,但如果在其他任何页面(而不是ie)上看到,则将看到数字.

Update As an example I saw this page where if you look at it on IE7 you wont see de numbers, but if you look at it on any other (but not ie) you will see the numbers.

谢谢

推荐答案

SSCCE 在IE6和IE6的所有浏览器中均能正常工作向上(IE6/7/8,FF2/3,Safari3,Chrome4,Opera9).

This SSCCE works fine in all browsers from IE6 and up (IE6/7/8, FF2/3, Safari3, Chrome4, Opera9).

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 2401705</title>
    </head>
    <body>
        <ol>
            <li>Item 1
            <li>Item 2
        </ol>
    </body>
</html>

当我尝试用语法上无效的<ol>替换</ol>时,它甚至可以工作.因此,您的问题出在其他地方.您确实需要在详细信息中详细说明无效".到底发生了什么? 不是究竟发生了什么?最好编辑您的问题以包括SSCCE(如上),然后尝试以智能方式提问.

It even works when I tried to replace the </ol> by the syntactically invalid <ol>. So, your problem lies somewhere else. You really need to elaborate the "Doesn't work" in more detail. What exactly happens? What exactly happens not? Preferably edit your question to include an SSCCE (like above) and try to ask the question the smart way.

请注意,与其他人所说的相反,在常规HTML中,非闭合的<li>在语法上是有效的.在XHTML中确实是无效的,但是除非您使用的是基于组件的MVC框架或其他基于XML的工具来生成HTML页面,否则我看不出使用XHTML的任何理由.

Note, in contrary to what others say, a non-closing <li> is syntactically valid in normal HTML. It's indeed invalid in XHTML, but I don't see any reason to use XHTML unless you're using a component based MVC framework or some other XML based tool to generate HTML pages.

更新:因此您看不到数字.显然,您已将olmargin设置为零.这样,他们将摆脱视野.以下SSCCE对此进行了演示.在IE6/7中确实失败了.

Update: you thus don't see the numbers. Apparently you've set the margin of the ol to zero. This way they will get out of the view. The following SSCCE demonstrates it. It indeed fails in IE6/7.

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 2401705 - IE6/7 problem</title>
        <style>ol { margin: 0; }</style>
    </head>
    <body>
        <ol>
            <li>Item 1
            <li>Item 2
        </ol>
    </body>
</html>

不要将页边距设置为0.这也可能是由所谓的CSS重置表引起的.不要使用它们,只需记住自己指定所有块元素的边距即可.

Don't set the margin to 0. This may also be caused by a so-called CSS reset sheet. Don't use them, just remember to specify the margins for all block elements yourself.

这篇关于有序列表不适用于IE7(&lt; ol&gt;&lt; li)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆