This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > October 2007 > text-align:center -- not working in FF..
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
text-align:center -- not working in FF..
|
|
|
| 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...
| |
| Rik Wasmus 2007-10-14, 6:17 pm |
| On Sun, 14 Oct 2007 18:04:16 +0200, maya <maya778899@yahoo.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.
--
Rik Wasmus
| |
|
| Rik Wasmus wrote:
> On Sun, 14 Oct 2007 18:04:16 +0200, maya <maya778899@yahoo.com> wrote:
>
> It does.
>
>
> 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..
| |
| Joshua Cranmer 2007-10-14, 6:17 pm |
| maya wrote:
> Rik Wasmus wrote:
>
>
> 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
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|