English 中文(简体)
Marking up an ordered list to start at point after 1
原标题:

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?

问题回答

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>

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





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签