ul to ol

Discussion in 'HTML' started by Jeff Thies, Jul 7, 2004.

  1. Jeff Thies

    Jeff Thies Guest

    Is it possible to change a unordered list to "appear" as an ordered
    list. Or perhaps vice versa. Perhaps a list-style setting?

    I've switched over to ThunderBird and this is my first post with it.
    Hope it goes well...

    Jeff
     
    Jeff Thies, Jul 7, 2004
    #1
    1. Advertising

  2. Jeff Thies

    Mark Parnell Guest

    Mark Parnell, Jul 7, 2004
    #2
    1. Advertising

  3. Jeff Thies

    Els Guest

    Jeff Thies wrote:

    > Is it possible to change a unordered list to "appear" as an
    > ordered list.


    Not that I know of.

    > Or perhaps vice versa. Perhaps a list-style
    > setting?


    Haven't tried, but list-style:none might take out the numbers,
    thus leaving it unordered, but without bullets either.

    Why don't you just change the ol to ul or ul to ol? Seems the
    best and simplest method.

    > I've switched over to ThunderBird and this is my first post
    > with it. Hope it goes well...


    Yep, went well.

    --
    Els
    http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
     
    Els, Jul 7, 2004
    #3
  4. Jeff Thies

    brucie Guest

    in post: <news:DzGGc.4385$>
    Jeff Thies <> said:

    > Is it possible to change a unordered list to "appear" as an ordered
    > list. Or perhaps vice versa. Perhaps a list-style setting?


    yes but why not just change the <ul> to <ol>?

    ul{list-style-type:none;}
    li:before {content:counter(blah)". ";counter-increment:blah 1;}

    will display

    <ul>
    <li>blah
    <li>blah
    <li>blah
    <ul>

    like this:

    1. blah
    2. blah
    3. blah

    supported by opera 6+ (maybe 5 but i cant find my copy to test)

    --
    b r u c i e
     
    brucie, Jul 7, 2004
    #4
  5. brucie wrote:
    > ul{list-style-type:none;}
    > li:before {content:counter(blah)". ";counter-increment:blah 1;}


    What's wrong with this?

    ul {list-style-type: decimal}
     
    Leif K-Brooks, Jul 7, 2004
    #5
  6. Jeff Thies

    brucie Guest

    in post: <news:>
    Leif K-Brooks <> said:

    >> ul{list-style-type:none;}
    >> li:before {content:counter(blah)". ";counter-increment:blah 1;}


    > What's wrong with this?
    > ul {list-style-type: decimal}


    nothing they just number <li>s differently, it depends how you want
    them.

    --
    b r u c i e
     
    brucie, Jul 7, 2004
    #6
  7. brucie <> wrote:

    > in post: <news:>
    > Leif K-Brooks <> said:
    >
    >>> ul{list-style-type:none;}
    >>> li:before {content:counter(blah)". ";counter-increment:blah 1;}

    >
    >> What's wrong with this?
    >> ul {list-style-type: decimal}

    >
    > nothing they just number <li>s differently, it depends how you want
    > them.


    They are rather different approaches, and the latter is far more widely
    supported; IE does not understand generated content (like :before pseudo-
    elements and counters) at all.

    You could assign other values to list-style-type as well, e.g.
    list-type-type: lower-roman
    to get the numberin i, ii, iii etc.

    But generally I agree with the comment that you should <ol> markup if you
    want to have the items automatically numbered. Although the difference
    between <ul> and <ol> might be seen as presentational only, it is more
    natural to treat it as "semi-structural" (in many cases at least).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Jul 7, 2004
    #7
  8. Jeff Thies

    Jeff Thies Guest

    Jukka K. Korpela wrote:

    > brucie <> wrote:
    >
    >
    >>in post: <news:>
    >>Leif K-Brooks <> said:
    >>
    >>
    >>>>ul{list-style-type:none;}
    >>>>li:before {content:counter(blah)". ";counter-increment:blah 1;}

    >>
    >>>What's wrong with this?
    >>>ul {list-style-type: decimal}

    >>
    >>nothing they just number <li>s differently, it depends how you want
    >>them.

    >
    >
    > They are rather different approaches, and the latter is far more widely
    > supported; IE does not understand generated content (like :before pseudo-
    > elements and counters) at all.
    >
    > You could assign other values to list-style-type as well, e.g.
    > list-type-type: lower-roman
    > to get the numberin i, ii, iii etc.
    >
    > But generally I agree with the comment that you should <ol> markup if you
    > want to have the items automatically numbered. Although the difference
    > between <ul> and <ol> might be seen as presentational only, it is more
    > natural to treat it as "semi-structural" (in many cases at least).
    >

    I've only come up with a couple of structural uses for ol:

    David Lettermans Top 10 list (not sure if that crosses the pond)
    Step by step instructions (which usually are so complex they often
    aren't in lists)

    There may be others, but it seems that unordered lists usually suffice.

    I haven't decided yet whether it is worth the option of switching
    between ol and ul (CMS) when altering styles is so easy. So far I've had
    no one ask for numbered lists in place of the unordered I've offered.

    Cheers,
    Jeff
     
    Jeff Thies, Jul 7, 2004
    #8
  9. brucie wrote:

    > supported by opera 6+ (maybe 5 but i cant find my copy to test)


    Supported by 5.1x, but not 5.0x IIRC.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Jul 7, 2004
    #9
  10. Jeff Thies wrote:

    > David Lettermans Top 10 list (not sure if that crosses the pond)


    Or indeed any list where order is important (duh): top 40 album chart; top
    20 browsers in a log file.

    Or any list where you need to refer back to specific items later. e.g.:

    Rules of Cricket.
    1. If you hit the ball and it is caught, you are out.
    2. If the ball hits the wicket, you are out.
    3. If the ball hits your leg, you are out.
    4. If the ball bounces before it is caught, rule #1 is not observed.
    5. If your leg is not in front of the wicket, rule #3 is not observed.
    6. To score a "run" you have to run from one crease to the other.
    7. If you hit the ball to the boundary, rule #6 no longer applies and you
    get 4 runs.
    8. If you hit the ball to the boundary without a bounce, rules #6 and #7
    can be ignored and you get 6 runs.
    9. A crease (see rule #6) is a line one and a half bats length from a
    wicket in the direction of the other wicket.
    10. etc...

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Jul 7, 2004
    #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.

Share This Page