Nested Ordered List

Discussion in 'HTML' started by CK, Jun 2, 2006.

  1. CK

    CK Guest

    Hello all,
    I have a nested ol and I need help with the numbering.
    For example.
    <ol>
    <li>Sweet</li>
    <li>Salty</li>
    <ol>
    <li>Very Salty</li>
    <li>lightly salted</li>
    </ol>
    <li>bitter</li>
    <li>sour</li>
    </ol>

    I want the output to be
    1.. Sweet
    2.. Salty
    1.1Very Salty
    1.2lightly salted
    3.. bitter
    4.. sour
    But it currently renders like this.
    1.. Sweet
    2.. Salty
    1.. Very Salty
    2.. lightly salted
    3.. bitter
    4.. sour
    I need the decimal style. Any ideas? Thanks ~CK
    CK, Jun 2, 2006
    #1
    1. Advertising

  2. CK

    Martin Jay Guest

    In message <I62gg.106318$>, CK
    <> writes
    >Hello all,
    >I have a nested ol and I need help with the numbering.


    >I want the output to be
    > 1.. Sweet
    > 2.. Salty
    > 1.1Very Salty
    > 1.2lightly salted
    > 3.. bitter
    > 4.. sour
    >But it currently renders like this.
    > 1.. Sweet
    > 2.. Salty
    > 1.. Very Salty
    > 2.. lightly salted
    > 3.. bitter
    > 4.. sour
    >I need the decimal style. Any ideas? Thanks ~CK


    I don't think you can do that without using a script. Couldn't you use
    letters, instead?

    Also, the HTML you posted was slightly incorrect because you started the
    second <ol> inside the first <ol>, but outside an <li>. Try this:

    <ol>
    <li>Sweet</li>
    <li>Salty
    <ol style="list-style-type: lower-alpha;">
    <li>Very Salty</li>
    <li>lightly salted</li>
    </ol>
    </li>
    <li>bitter</li>
    <li>sour</li>
    </ol>
    --
    Martin Jay
    Phone/SMS: +44 7740 191877
    Fax: +44 870 915 2124
    Martin Jay, Jun 2, 2006
    #2
    1. Advertising

  3. CK <> scripsit:

    > I have a nested ol and I need help with the numbering.


    If you really want help, select _the_ group where the question best belongs
    to. Crossposting is generally not constructive. Followups randomized as
    usual.

    > I want the output to be
    > 1.. Sweet
    > 2.. Salty
    > 1.1Very Salty
    > 1.2lightly salted


    No way. (CSS 2.0 contains tools for generating list markers that way, but
    this part was not implemented in browsers and is being phased out in CSS
    2.1.)

    Use either an unnumbered list, with list-style-type: none in CSS and with
    the numbers included into the items themselves, or some other (admittedly
    less logical) structure, such as a table.

    > I need the decimal style.


    That's a reasonable request, but browsers won't do it for you.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Jun 2, 2006
    #3
  4. CK

    dorayme Guest

    In article <I62gg.106318$>,
    "CK" <> wrote:

    > Hello all,
    > I have a nested ol and I need help with the numbering.
    > For example.


    > I need the decimal style. Any ideas? Thanks ~CK


    Yes, you need to set the list-style-type. This might do you, I
    will give you an inline style for now on the bit that you
    probably want different to the normal decimal of the rest:

    <ol style="list-style-type: lower-roman">
    <li>Very Salty</li>
    <li>lightly salted</li>
    </ol>

    --
    dorayme
    dorayme, Jun 2, 2006
    #4
  5. CK

    dorayme Guest

    In article
    <>,
    dorayme <> wrote:

    > In article <I62gg.106318$>,
    > "CK" <> wrote:
    >
    > > Hello all,
    > > I have a nested ol and I need help with the numbering.
    > > For example.

    >
    > > I need the decimal style. Any ideas? Thanks ~CK

    >
    > Yes, you need to set the list-style-type. This might do you, I
    > will give you an inline style for now on the bit that you
    > probably want different to the normal decimal of the rest:
    >
    > <ol style="list-style-type: lower-roman">
    > <li>Very Salty</li>
    > <li>lightly salted</li>
    > </ol>


    but it seems it was the decimal numbering you wanted... forget
    this, sorry...

    --
    dorayme
    dorayme, Jun 3, 2006
    #5
  6. CK

    Ed Seedhouse Guest

    On Fri, 02 Jun 2006 21:31:20 GMT, "CK" <> wrote:

    >Hello all,
    >I have a nested ol and I need help with the numbering.
    >For example.
    ><ol>
    > <li>Sweet</li>
    > <li>Salty</li>
    > <ol>
    > <li>Very Salty</li>
    > <li>lightly salted</li>
    > </ol>
    > <li>bitter</li>


    First, you should get your html legal:

    > <li>Salty
    > <ol>
    > <li>Very Salty</li>
    > <li>lightly salted</li>
    > </ol>
    > </li>
    > <li>bitter</li>


    Everthing in an ordered list has to go inside the list items.
    Ed Seedhouse, Jun 3, 2006
    #6
  7. CK

    ironcorona Guest

    CK wrote:

    > I want the output to be
    > 1.. Sweet
    > 2.. Salty
    > 1.1Very Salty
    > 1.2lightly salted
    > 3.. bitter
    > 4.. sour
    > But it currently renders like this.
    > 1.. Sweet
    > 2.. Salty
    > 1.. Very Salty
    > 2.. lightly salted
    > 3.. bitter
    > 4.. sour
    > I need the decimal style. Any ideas? Thanks ~CK


    I couldn't make it work with a list but in the interests of science I
    came up with a sort of hackey workaround.

    http://iron.corona.googlepages.com/list_counter.html

    As you can see it's not a list any more and it won't work in IE.

    Does anyone know when FF started supporting counter-increment? They
    didn't quite recently.

    --
    Brian O'Connor (ironcorona)
    ironcorona, Jun 3, 2006
    #7
  8. CK

    Bud Guest

    ironcorona wrote:
    > CK wrote:
    >
    >> I want the output to be
    >> 1.. Sweet
    >> 2.. Salty
    >> 1.1Very Salty
    >> 1.2lightly salted
    >> 3.. bitter
    >> 4.. sour
    >> But it currently renders like this.
    >> 1.. Sweet
    >> 2.. Salty
    >> 1.. Very Salty
    >> 2.. lightly salted
    >> 3.. bitter
    >> 4.. sour
    >> I need the decimal style. Any ideas? Thanks ~CK

    >
    > I couldn't make it work with a list but in the interests of science I
    > came up with a sort of hackey workaround.
    >
    > http://iron.corona.googlepages.com/list_counter.html
    >
    > As you can see it's not a list any more and it won't work in IE.
    >
    > Does anyone know when FF started supporting counter-increment? They
    > didn't quite recently.


    In Konqueror it does but in FF 1.0.2 no, but that is old now.

    --
    "I never fail to convince an audience that the best thing they could do
    was to go away."
    I'm going back to windoze, too many dammed options with linux ;)
    -- Blumf
    Bud, Jun 3, 2006
    #8
  9. Bud wrote:
    > ironcorona wrote:
    >> CK wrote:
    >>
    >>> I want the output to be
    >>> 1.. Sweet
    >>> 2.. Salty
    >>> 1.1Very Salty
    >>> 1.2lightly salted
    >>> 3.. bitter
    >>> 4.. sour
    >>> But it currently renders like this.
    >>> 1.. Sweet
    >>> 2.. Salty
    >>> 1.. Very Salty
    >>> 2.. lightly salted
    >>> 3.. bitter
    >>> 4.. sour
    >>> I need the decimal style. Any ideas? Thanks ~CK

    >> I couldn't make it work with a list but in the interests of science I
    >> came up with a sort of hackey workaround.
    >>
    >> http://iron.corona.googlepages.com/list_counter.html
    >>
    >> As you can see it's not a list any more and it won't work in IE.
    >>
    >> Does anyone know when FF started supporting counter-increment? They
    >> didn't quite recently.

    >
    > In Konqueror it does but in FF 1.0.2 no, but that is old now.
    >


    Fixed in FF 1.5+

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Jun 3, 2006
    #9
  10. CK

    jojo Guest

    Martin Jay schrieb:
    > In message <I62gg.106318$>, CK
    > <> writes
    >> Hello all,
    >> I have a nested ol and I need help with the numbering.

    >
    >> I want the output to be
    >> 1.. Sweet
    >> 2.. Salty
    >> 1.1Very Salty
    >> 1.2lightly salted
    >> 3.. bitter
    >> 4.. sour
    >> But it currently renders like this.
    >> 1.. Sweet
    >> 2.. Salty
    >> 1.. Very Salty
    >> 2.. lightly salted
    >> 3.. bitter
    >> 4.. sour
    >> I need the decimal style. Any ideas? Thanks ~CK

    >
    > I don't think you can do that without using a script.


    But, of course, you can use a script...
    Easiest way would be JavaScript because it's supported by almost every
    Browser. The only problem is, that many users switch off JavaScript
    because of security-reasons. But if you want to do it with a Script just
    tell me, I think I can write you a Script numbering your list as you
    requested...
    jojo, Jun 18, 2006
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newbie
    Replies:
    1
    Views:
    509
    Andrew Thompson
    Apr 7, 2004
  2. Arvind Ganesan

    ordered list (OL) tag with tables

    Arvind Ganesan, Sep 6, 2003, in forum: HTML
    Replies:
    10
    Views:
    10,458
    Nico Schuyt
    Sep 6, 2003
  3. Replies:
    3
    Views:
    2,124
  4. CK

    Nested Ordered List

    CK, Jun 2, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    9,767
  5. DL

    Ordered list inside ordered list

    DL, Nov 9, 2009, in forum: Javascript
    Replies:
    6
    Views:
    307
    Dr J R Stockton
    Nov 21, 2009
Loading...

Share This Page