center <ol> in <div>

Discussion in 'HTML' started by Shank, Aug 12, 2006.

  1. Shank

    Shank Guest

    In the below, how do I get the <ol> block to center in the <div>?
    I've tried: <ol style="text-align:left; margin-left:auto;
    margin-right:auto"> no luck!
    I want the <ol> to remain left aligned, but the whole block centered on the
    page.
    thanks!

    <div style="font-family:Arial, Helvetica, sans-serif; text-align:center;
    padding:20px; background-color:#FFFF00; color:#990000">
    <p style=" padding:3px">
    xxxxxxxxxxxxxxxxxxxxx<br>
    xxxxxxxxxxxxxxxxxxxxx</p>
    <img src="300.jpg" border="0">
    <p style="color:#990000; font-size:120%">xxxxxx</p>
    <ol style="text-align:left">
    <li>xxxxx</li>
    <li>xxxxx</li>
    <li>xxxxx</li>
    <li>xxxxx</li>
    <li>xxxxx</li>
    <li>xxxxx</li>
    </ol></div>
    Shank, Aug 12, 2006
    #1
    1. Advertising

  2. Shank wrote:

    > In the below, how do I get the <ol> block to center in the <div>?
    > I've tried: <ol style="text-align:left; margin-left:auto;
    > margin-right:auto"> no luck!


    That is centered, you just can't see it as it spans the entire width of the
    div as you haven't set a width on it.

    http://dorward.me.uk/www/centre/

    > I want the <ol> to remain left aligned, but the whole block centered on
    > the page.


    So shouldn't you be centring the div then?


    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Aug 12, 2006
    #2
    1. Advertising

  3. Shank

    Shank Guest

    "David Dorward" <> wrote in message
    news:ebk8dj$7fo$1$...
    > Shank wrote:
    >
    >> In the below, how do I get the <ol> block to center in the <div>?
    >> I've tried: <ol style="text-align:left; margin-left:auto;
    >> margin-right:auto"> no luck!

    >
    > That is centered, you just can't see it as it spans the entire width of
    > the
    > div as you haven't set a width on it.
    >
    > http://dorward.me.uk/www/centre/
    >
    >> I want the <ol> to remain left aligned, but the whole block centered on
    >> the page.

    >
    > So shouldn't you be centring the div then?
    >
    >
    > --
    > David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>

    ----------------------------------
    I was not aware the <ol> spanned the whole distance. My goof! How do I set
    the width of the <div> where it will accommodate changing widths in the
    <ol>? I don't want the <ol> to wrap text onto next lines. I guess what I
    need is a collapse attribute for the <div>.
    thanks
    Shank, Aug 12, 2006
    #3
    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. Ben Amada

    Replacement for <div align="center">

    Ben Amada, Nov 30, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    16,256
    Ben Amada
    Dec 1, 2005
  2. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    728
  3. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    178
    David Dorward
    Jun 1, 2005
  4. mscir
    Replies:
    3
    Views:
    299
    Martin Honnen
    Jun 26, 2005
  5. Gernot Frisch

    center div over another div

    Gernot Frisch, Mar 16, 2006, in forum: Javascript
    Replies:
    1
    Views:
    173
    Randy Webb
    Mar 16, 2006
Loading...

Share This Page