center <ol> in <div>

S

Shank

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>
 
D

David Dorward

Shank said:
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?
 
S

Shank

David Dorward said:
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/


So shouldn't you be centring the div then?
----------------------------------
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top