从一定数量开始列表 [英] Start a list from a certain number

查看:79
本文介绍了从一定数量开始列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获得 ol 从'x'开始的最佳方法是什么?
$ b

start 标记已被弃用,我在Google上发现的所有内容都使用了:之前伪类在IE6或7中不起作用。搜索堆栈时没有太多好运。



只有我可以想到是手动通过并自己编号列表和样式?



任何帮助表示赞赏。

解决方案

虽然 <$ c HTML 4中的$ c> start 属性确实被弃用了,查看 HTML 5 docs ,我看到:


start 属性(如果存在)必须是提供第一个列表项的序号值的有效整数。



如果 start 属性存在,用户代理必须将其解析为i nteger,以确定属性的值。如果该元素没有反转属性,则缺省值用于1,如果该属性缺失或者该值不能根据引用的算法转换为数字,则为1;



列表中的第一项具有序号给出的序数值 ol 元素的开始属性,除非 li 元素具有一个value属性,其值可以被成功解析,其中如果它具有该值属性赋予的序号值,那么就可以使用 start / code>与 ol 值与 li 元素。


What's the best way to get a ol to start from 'x'?

The start tag is deprecated and everything I have found on Google has used the :before pseudo class which doesn't work in IE6 or 7. Didn't have much luck when searching stack either.

Only thing I can think of is manually go through and number the lists myself and style accordingly?

Any help appreciated.

解决方案

While the start attribute in HTML 4 is indeed deprecated, looking at the HTML 5 docs, I see:

The start attribute, if present, must be a valid integer giving the ordinal value of the first list item.

If the start attribute is present, user agents must parse it as an integer, in order to determine the attribute's value. The default value, used if the attribute is missing or if the value cannot be converted to a number according to the referenced algorithm, is 1 if the element has no reversed attribute, and is the number of child li elements otherwise.

The first item in the list has the ordinal value given by the ol element's start attribute, unless that li element has a value attribute with a value that can be successfully parsed, in which case it has the ordinal value given by that value attribute.

which tells me I am safe using start with ol and value with li elements.

这篇关于从一定数量开始列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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