HighDots Forums  

text-align:center -- not working in FF..

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


Discuss text-align:center -- not working in FF.. in the Cascading Style Sheets forum.



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

Default text-align:center -- not working in FF.. - 10-14-2007 , 12:04 PM






hi,

text-align:center is not working in FF for body... code:

body {background-image:url(bg2.jpg); margin-top:0; margin-left:0;
margin-right:0; margin-bottom:0; text-align:center;
background-attachment:fixed;}


in body I have a div, of a specific width, it's not centered in FF...
for div also put text-align:center, inside the div it works fine,
content is centered... (but div is not centered in browser window.. if
I put plain text ABOVE the div, it's centered, but the div is not
centered..)

<div id="main" style="width:850px; background-color:#FFFFFF;
height:100%; text-align:center; border-left: solid 6px #eaeaea;
border-right: solid 6px #eaeaea;"> ... </div>

now I have seen this done all the time, we do it also at work, I don't
get why now it's not working for me in FF in body (but works in a div..)
isn't this also the way layout for many blogs is done? (so main content
area is always in center of window)??

(FF version is 2.0.0.7..)

code mentioned above is here.. http://www.mayacove.com/misc/test.html

thank you...








Reply With Quote
  #2  
Old   
Rik Wasmus
 
Posts: n/a

Default Re: text-align:center -- not working in FF.. - 10-14-2007 , 12:11 PM






On Sun, 14 Oct 2007 18:04:16 +0200, maya <maya778899 (AT) yahoo (DOT) com> wrote:
Quote:
text-align:center is not working in FF for body... code:
It does.

Quote:
body {background-image:url(bg2.jpg); margin-top:0; margin-left:0;
margin-right:0; margin-bottom:0; text-align:center;
background-attachment:fixed;}


in body I have a div, of a specific width, it's not centered in FF...
for div also put text-align:center, inside the div it works fine,
content is centered... (but div is not centered in browser window.. if
I put plain text ABOVE the div, it's centered, but the div is not
centered..)
A DIV is a block, not text.
Use something like div{margin:0 auto;} to center it.
--
Rik Wasmus


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

Default Re: text-align:center -- not working in FF.. - 10-14-2007 , 12:25 PM



Rik Wasmus wrote:
Quote:
On Sun, 14 Oct 2007 18:04:16 +0200, maya <maya778899 (AT) yahoo (DOT) com> wrote:
text-align:center is not working in FF for body... code:

It does.

body {background-image:url(bg2.jpg); margin-top:0; margin-left:0;
margin-right:0; margin-bottom:0; text-align:center;
background-attachment:fixed;}


in body I have a div, of a specific width, it's not centered in FF...
for div also put text-align:center, inside the div it works fine,
content is centered... (but div is not centered in browser window..
if I put plain text ABOVE the div, it's centered, but the div is not
centered..)

A DIV is a block, not text.
Use something like div{margin:0 auto;} to center it.

thank you.. that worked... what does 'auto' do?? (and why would how
much margin for the div make a difference??)

thank you very much..



Reply With Quote
  #4  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: text-align:center -- not working in FF.. - 10-14-2007 , 01:13 PM



maya wrote:
Quote:
Rik Wasmus wrote:
On Sun, 14 Oct 2007 18:04:16 +0200, maya <maya778899 (AT) yahoo (DOT) com> wrote:
text-align:center is not working in FF for body... code:

It does.

body {background-image:url(bg2.jpg); margin-top:0; margin-left:0;
margin-right:0; margin-bottom:0; text-align:center;
background-attachment:fixed;}


in body I have a div, of a specific width, it's not centered in FF...
for div also put text-align:center, inside the div it works fine,
content is centered... (but div is not centered in browser window..
if I put plain text ABOVE the div, it's centered, but the div is not
centered..)

A DIV is a block, not text.
Use something like div{margin:0 auto;} to center it.


thank you.. that worked... what does 'auto' do?? (and why would how
much margin for the div make a difference??)

thank you very much..

The 'auto' keyword divides any extra space equally between the two
margins. See CSS 2.1 §10 for more information.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


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 - 2009, Jelsoft Enterprises Ltd.