I would like to put <center></center> between <body></body> tags (how to do this: <body><center>.........</center></body>) in a stylesheet. This is because FireFox don't center the body's content with the attribute text-align: center in body definition ({body tex--align:center }.I must manually enter the <center> ... </center> tags in every one of 30 web pages!
If you know how to do, you can help me for saving time. Thanks!
How to put <center></center> between body tags
Use CSS instead of <center>.
body {
margin: 0 auto;
}
edit: Shame on me
CSS: .container { margin: 0 auto; } HTML: <div class="container"> <!-- content goes here --> </div>
How to put <center></center> between body tags
Hi
I may be wrong (I often am), but I think you need to have a fixed width defined in order that the auto thing will work. So, either the body has a width (of, say 760px), or you make a pagecontainer div (or somesuchlike) and do the same.
Trevor
PS, this centering method won't work for IE5, which needs text-align:center
How to put <center></center> between body tags
You are wright. I must have a width for the body (600px) for {body margin: 0 auto} to work. Excellent idea! Thanks!
How to put <center></center> between body tags
do not give body fixed witdh.
first DIV "box or Container"..
<div align="center">
.. content..
next one (div) you give fixed width..
</div>
How to put <center></center> between body tags
do not give body fixed width.
Why not?
How to put <center></center> between body tags
FireFox centers quite well with a width to the body! I confirm.
How to put <center></center> between body tags
Hi
Tyssen, what happens to a repeating background image if the body is width-restricted?
Trevor
How to put <center></center> between body tags
What on earth is this thread on about :? it looks like a good candidate or the prize of "posts most at cross purposes"
Why are we trying to center the 'body'? and why are we giving it fixed width? (not that it's not possible)
I think what Alexx was trying to say was not to center the body but to center a container within body as is normal practise.
@ntrg why do feel the need to work on the body tag in this fashion? rather than center a container/wrapper div using fixed width and auto margins and text-align:center on the body tag.
Tyssen, what happens to a repeating background image if the body is width-restricted?
It would just repeat over the declared body width, wouldn't it?
But we haven't mentioned the html tag.
Hugo.
How to put <center></center> between body tags
I think what Alexx was trying to say was not to center the body but to center a container within body as is normal practise.
@ntrg why do feel the need to work on the body tag in this fashion? rather than center a container/wrapper div using fixed width and auto margins and text-align:center on the body tag.
:oops: What I meant to say in the first place, I did not intend to center a the body, but a container in it.
How to put <center></center> between body tags
Hi Hugo
That was why I made my first post.
It would just repeat over the declared body width, wouldn't it?
Then there was a suggestion of a fixed width on the body, to which my answer was to pose that question, because the answer, which I knew (thanks) would probably not be what anyone would want to do.
I thought my first answer was what ntrg wanted. The rest was superfluous.
But this could go on like the Monty Python Cheese Shop sketch.
Trevor
How to put <center></center> between body tags
Phew I'm glad you knew that then
I see now that it was one of those rehetetorical jobbies
Yes your first post did answer the question though ntrg did seem to take you up on the offer of playing with the body element.
Of course an image could be tiled across the html element.
This does have the feel of a Python sketch, lets see how far we can take it, never know we could start a sketch show for coders.
Hugo.
How to put <center></center> between body tags
I'll have spam, spam, spam, spam, eggs and spam.
How to put <center></center> between body tags
Of course an image could be tiled across the html element.
Thereby making my Divitis article even better