开发者

Define <OL> start value

Building on the post I found at Ordered Lists <OL>, Starting index with XHTML Strict?, I was wondering if there is a way to define the start value of a list without using CSS and still be compliant conforming to the strict DTD specification? I am also looking for a solution of the "value" attribute assigned to the tag li.

Can I only start with a numerical v开发者_StackOverflow社区alue? Am I able to commence with a specific alphabet for example?


correct way:

<ol>
    <li value='10'>item</li>
    <li>item</li>
    <li>item</li>
</ol>

correct, but deprecated

<ol start='20'>
    <li>item</li>
    <li>item</li>
    <li>item</li>
</ol>

ugly hack XD

<style>
    li.hidden { visibility: hidden; height: 0px; font-size: 0px;
    /* don't try with display:none, trust me */  }
</style>
<ol>
    <li class='hidden'></li>
    <li class='hidden'></li>
    <li class='hidden'></li>
    <li>item 4</li>
    <li>item 5</li>
    <li>item 6</li>
</ol>


It's deprecated but you can specify <ol start="5">, for instance. I'm not sure if you'll be able to pass strict standards using a deprecated attribute, though.

If you also use the type attribute to change the list type to say, roman or alphabetic, but when you specify start you would need to specify a number.

For a particular list item you can specify attributes of type and value, where value must be specified numerically but will be displayed in the appropriate type. These attributes, however, are also deprecated.

Other than these methods there are no other ways to specify the start without using at least a little CSS. You can put the CSS in a local style attribute if you're averse to dumping it in the header.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜