homepage Welcome to WebmasterWorld Guest from 184.72.82.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
xhtml 1.1 and "start" or "value" in ordered lists
Can we start with any given number instead of 1?
Gusgsm




msg:561829
 10:06 pm on Feb 3, 2003 (gmt 0)

Good evening, folks,

I'm trying as hard as I can to keep/convert a tiny site to xhtml 1.1. Now I've faced the trouble of starting an ordered list with a number different from "1". In hmtl I'd say <ol start="2"> or <li value="2"> but this two attributes are deprecated in xhtml 1.1

Some references in the Web seem to point to some CSS way to do that but I'm clueless about it.

Is there any kind sould that could lend me a helping hand in this?

Thanks in advance

gusgsm

 

Nick_W




msg:561830
 10:25 pm on Feb 3, 2003 (gmt 0)

Good question!
I couldn't find anything in the CSS2 spec on this. In fact, I didn't even know it could be done ;)

Anyone have the answer?

Nick

SuzyUK




msg:561831
 10:45 pm on Feb 3, 2003 (gmt 0)

It can be done but not with CSS and XHTML

I have no online reference, but here's a direct quote from a publication (my offline reference!):


  • Q.How do I set the starting values for ordered lists using CSS?
  • A. Unfortunately, you can't set those with CSS. In order to set specific number values for ordered lists, you'll need to use the HTML start attribute on the <ol> element or the value attribute on <li>. Both of these values are deprected in HTML 4.01, which means you can't use them in Strict HTML Documents.
  • So does this mean they're not available for Strict or Transitional XHTML?

    Suzy

    tedster




    msg:561832
     11:31 pm on Feb 3, 2003 (gmt 0)

    In Section 12.5, this page at the W3C [w3.org] talks about the use of counter-reset. It could be applied to a class of the <ol> element.

    Haven't tried it, so I can't talk about browser support. But in theory, there's the answer.

    quiet_man




    msg:561833
     11:32 pm on Feb 3, 2003 (gmt 0)

    >>The "compact", "start" and "type" attributes of the ol element are not supported in XHTML 1.0 Strict DTD<<

    From W3Schools.com > OL tag [w3schools.com]

    However, this same page seems to suggest that 'start' is allowed in XHTML Transitional and Frameset DTDs, so maybe Transitional is the way to go?

    I have also seen some of those references to using stylesheets instead, and I too would be interested to find out how this could be done.

    tedster




    msg:561834
     2:08 am on Feb 4, 2003 (gmt 0)

    I did some browser testing for support of the above scheme. This was my CSS:

    OL{
    counter-reset: item,3;
    }

    LI {
    display: block;
    }

    LI:before {
    content: counters(item, ".");
    counter-increment: item;
    padding-right:8px;
    }

    I notice that support for the :before pseudo element is key to this approach, and that is might scarce right now.

    The only support I found so far is in Opera 7, and it doesn't add the period after the number. But it DOES begin numbering the list items at 4 -- as it should when the reset is set to "3".

    I also tested in Phoenix and IE6 - nada.

    <added>
    As I worked with this, I could see how valuable it will be, if and when it has support. For instance, you could publish a document online and when you added or removed headings, the numbers for them would automatically reset throughout the page. You wouldn't need to deal with that manually at all.
    </added>

    Gusgsm




    msg:561835
     9:37 am on Feb 4, 2003 (gmt 0)

    Well, thank you all a lot! (specially to tedster).

    Yes that's the CSS2 way. Quite a pity that it does not seem to be implemented yet, but the counter possibilities of the CSS2 seem to be extremely powerful for long legal-like numbered documents.

    Thanks again, folks. Your kindness made my day :)

    PS: I have found (now that I know what I'm looking for) this: [xs4all.nl...]

    Global Options:
     top home search open messages active posts  
     

    Home / Forums Index / Code, Content, and Presentation / HTML
    rss feed

    All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
    Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
    WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
    © Webmaster World 1996-2014 all rights reserved