将有序列表标记为从 1 之后的点开始

发布于 2024-08-15 19:59:42 字数 177 浏览 2 评论 0原文

因此,根据 W3C 规范,有序列表中的“start”属性已被弃用。

如果您想继续由一系列标题分解的列表,您可能会:

<ol start="15"> 

但这是不允许的。问题是,除了在当前浏览器中运行的方法之外,您还能/会怎么做?不可能完成的任务?

So, according the W3C spec, the 'start' attribute in an ordered list is deprecated.

If you want to continue a list that's been broken up by a series of heading, you might have:

<ol start="15"> 

But that would not be allowed. The questions is how else could you/would you do it other than that which works in current browsers? Mission impossible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

坚持沉默 2024-08-22 19:59:42

HTML4.01 可能已弃用 start 属性,但它已返回适用于 HTML5。 是否存在浏览器兼容性问题?

编辑: SitePoint 说不。 所以唯一真正的问题是验证。如果您确实关心验证,则可以使用 HTML 4.01 Transitional 或 HTML5,但不能使用 Strict。

否则,您将不得不将其他行保留在 HTML 中并隐藏它们。

<style type="text/css">.hidden { display: none }</style>

<ol>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li>Starting at 5</li>
</ol>

The start attribute may be deprecated for HTML4.01, but it has returned for HTML5. Is there a browser compatibility issue?

EDIT: SitePoint says no. So the only real issue is validation. You can use HTML 4.01 Transitional, or HTML5, but not Strict, if you're really concerned about validation.

Otherwise, you're stuck with having the other lines in the HTML and hiding them.

<style type="text/css">.hidden { display: none }</style>

<ol>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li class="hidden"></li>
    <li>Starting at 5</li>
</ol>
与之呼应 2024-08-22 19:59:42

您可以使用 CSS 计数器来完成此操作,但并非所有浏览器都支持它们。毕竟,起始属性是您最好的选择。

You can do it with CSS counters, but they are not supported in all browsers. The start attribute is your best bet after all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文