HighDots Forums  

Re: CSS / DIV Centering

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: CSS / DIV Centering in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dorayme
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-17-2007 , 11:21 PM






In article
<b4cacd25-9660-44b9-9a38-998898d9eaff (AT) l32g2000hse (DOT) googlegroups.co
m>,
rbrowning1958 <RBrowning1958 (AT) gmail (DOT) com> wrote:

Quote:
Hello,

I'm sure this has been asked numerous times before - but none of the
solutions I have found seem to work for me. I want a page width, say
500px, centered within the browser's window. Here's the HTML:


div id="container"
div id="sidebar"
Side bar text
/div
div id="mainContent"
Main content text
/div
/div


#container {
border:1px solid #000;
text-align: left;
width: 500px;
margin-left: auto;
margin-right: auto;
}


Any ideas why this isn't working - the examples I've seen say it
should - IE most recent version (the one without the menu so I've no
idea hot to find out what version it is - 7?).

Use:

#container {
border:1px solid #000;
text-align: center ;
width: 500px;
margin-left: auto;
margin-right: auto;
}

#sidebar {text-align: left;}
#mainContent {text-align: left;}

(if you want left text in the inner children, that is...)

--
dorayme


Reply With Quote
  #2  
Old   
rbrowning1958
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-18-2007 , 12:38 AM






On Dec 18, 5:21 am, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
Quote:
In article
b4cacd25-9660-44b9-9a38-998898d9e... (AT) l32g2000hse (DOT) googlegroups.co
m>,





rbrowning1958<RBrowning1... (AT) gmail (DOT) com> wrote:
Hello,

I'm sure this has been asked numerous times before - but none of the
solutions I have found seem to work for me. I want a page width, say
500px, centered within the browser's window. Here's the HTML:

div id="container"
div id="sidebar"
Side bar text
/div
div id="mainContent"
Main content text
/div
/div

#container {
border:1px solid #000;
text-align: left;
width: 500px;
margin-left: auto;
margin-right: auto;
}

Any ideas why this isn't working - the examples I've seen say it
should - IE most recent version (the one without the menu so I've no
idea hot to find out what version it is - 7?).

Use:

#container {
border:1px solid #000;
text-align: center ;
width: 500px;
margin-left: auto;
margin-right: auto;

}

#sidebar {text-align: left;}
#mainContent {text-align: left;}

(if you want left text in the inner children, that is...)

--
dorayme- Hide quoted text -

- Show quoted text -
Hello and thanks for that. I have tried similar things but they didn't
work and neither did yours. I've think I've found my issue though. I'm
guessing my browser was working in quirk mode where I guess this
centering didn't work. If I change my doctype to strict it works fine.
I'm guessing though this might not work so well with other browsers -
is your text-align center in the container to do with older browsers?

Ta Ray


Reply With Quote
  #3  
Old   
dorayme
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-18-2007 , 01:09 AM



In article
<68a061e2-ac30-4dd2-9803-61efc4cb0cb0 (AT) e25g2000prg (DOT) googlegroups.co
m>,
rbrowning1958 <RBrowning1958 (AT) gmail (DOT) com> wrote:

Quote:
On Dec 18, 5:21 am, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
In article
b4cacd25-9660-44b9-9a38-998898d9e... (AT) l32g2000hse (DOT) googlegroups.co
m>,


Hello and thanks for that. I have tried similar things but they didn't
work and neither did yours. I've think I've found my issue though. I'm
guessing my browser was working in quirk mode where I guess this
centering didn't work. If I change my doctype to strict it works fine.
I'm guessing though this might not work so well with other browsers -
is your text-align center in the container to do with older browsers?


Are you saying that

http://netweaver.com.au/alt/browning.html

fails to centre in some browser you are using. Which one please?

--
dorayme


Reply With Quote
  #4  
Old   
rf
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-18-2007 , 01:27 AM




"dorayme" <doraymeRidThis (AT) optusnet (DOT) com.au> wrote


Quote:
Are you saying that

http://netweaver.com.au/alt/browning.html

fails to centre in some browser you are using. Which one please?
IE 5.01, IE 5.5 :-)

--
Richard.




Reply With Quote
  #5  
Old   
dorayme
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-18-2007 , 01:53 AM



In article <lDK9j.25011$CN4.10500 (AT) news-server (DOT) bigpond.net.au>,
"rf" <rf (AT) invalid (DOT) com> wrote:

Quote:
"dorayme" <doraymeRidThis (AT) optusnet (DOT) com.au> wrote in message
news:doraymeRidThis-C1D0FD.18091818122007 (AT) news-vip (DOT) optusnet.com.au...

Are you saying that

http://netweaver.com.au/alt/browning.html

fails to centre in some browser you are using. Which one please?

IE 5.01, IE 5.5 :-)
You mean presumably, Win IE. Fair enough, it certainly did not
cross my mind that OP was using this or worried about it. But
thanks. I now add further advice:

Don't trouble your head about WinIE5. Nobody bloody well uses it.

(btw. MacIE5, being a different beast has no such trouble, but it
is likely as little used too).

--
dorayme


Reply With Quote
  #6  
Old   
rbrowning1958
 
Posts: n/a

Default Re: CSS / DIV Centering - 12-18-2007 , 08:07 AM



On Dec 18, 7:09 am, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
Quote:
In article
68a061e2-ac30-4dd2-9803-61efc4cb0... (AT) e25g2000prg (DOT) googlegroups.co
m>,

rbrowning1958<RBrowning1... (AT) gmail (DOT) com> wrote:
On Dec 18, 5:21 am, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
In article
b4cacd25-9660-44b9-9a38-998898d9e... (AT) l32g2000hse (DOT) googlegroups.co
m>,

Hello and thanks for that. I have tried similar things but they didn't
work and neither did yours. I've think I've found my issue though. I'm
guessing my browser was working in quirk mode where I guess this
centering didn't work. If I change my doctype to strict it works fine.
I'm guessing though this might not work so well with other browsers -
is your text-align center in the container to do with older browsers?

Are you saying that

http://netweaver.com.au/alt/browning.html

fails to centre in some browser you are using. Which one please?

--
dorayme
Hi yes it does center - but your doctype is different from my original
doc type which was causing the error. I'm using an ancient version of
Dreamweaver and that's what it threw in as the default. What is the
text-align center all about? Is this to fix some errors in older
browsers?

Ta

Ray


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.