Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is there a way to get <ol> to start numbering with a number other than 1?

    An attribute or CSS property would be great.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,700
    Thanks
    0
    Thanked 233 Times in 228 Posts
    Hi there me',

    This is the attribute that will
    solve your dilemma ....

    <ol start="100">
    <li >one</li>
    <li >two</li>
    <li >three</li>
    </ol>

    cthead

  • #3
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Doesn't seem to exist under xhtml1.1, but it works in Moz. Is it valid?
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For valid code use counter-reset. See http://www.w3.org/TR/CSS2/generate.html#counters
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    It's valid transitional, but not strict. I'm not sure I agree with the HTML WG about making counters CSS based, though - I consider them semantic and not just presentational, because the may have real, useful meaning.
    From the [XHTML1.0 Transitional DTD]:
    Code:
    <!ELEMENT ol (li)+>
    <!ATTLIST ol
      %attrs;
      type        %OLStyle;      #IMPLIED
      compact     (compact)      #IMPLIED
      start       %Number;       #IMPLIED
      >
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,700
    Thanks
    0
    Thanked 233 Times in 228 Posts
    Hi there me'

    .....or use a little js...

    <script type="text/javascript">
    <!--
    function Order()
    {
    document.getElementById('ol').start='10';
    }
    onload=Order;
    //-->
    </script>

    <ol id="ol">
    <li >one</li>
    <li >two</li>
    <li >three</li>
    </ol>

    cthead

  • #7
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled.

  • #8
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by missing-score
    thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled.
    Actually not a problem, it's an interface that will only run on my own machine.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #9
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh i see, fair doos.

  • #10
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,700
    Thanks
    0
    Thanked 233 Times in 228 Posts
    Hi there missing-score,
    thats ok but isnt very nice to have stuck into the middle of a page. The page then seems not to make sense if the user doesnt have javascript enabled.
    ...actually the little bit of script would be placed within the head tags.

    cthead

  • #11
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    whatever lol, i wasnt really meaning where it would be exactly, i doubt the script would be in the exact middle anyways even if it was in the body tag, but what i meant is for a site that the world could visit, it would be better if there was a non js alternative.

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm with liorean on this one - if the numbering system is vital to the meaning of the list, then you should use "list-style-type:none" on a <ul> and then implement the numbering manually.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #13
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by brothercake
    I'm with liorean on this one - if the numbering system is vital to the meaning of the list, then you should use "list-style-type:none" on a <ul> and then implement the numbering manually.
    ++i

    It just feels so wrong to number a list using JS. But if it's only for you to view (David), then obviously it's far less crutial.

    I take no responsibility for the above nonsense.


    Left Justified

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I never said anything about using JS .. I meant manually:
    Code:
    <li>1. blah blah</li>
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #15
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well that's semantically incorrect. It's not an unordered list, it's an ordered one. Although that solution applies to <ol> as well.
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •