![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, I am trying to get a CSS defined layout to center on the page, have tried doing this with the <center></center> tags but than everything is centered, including text etc etc. What should I put into the stylesheet so that, no matter what resolution the viewer's screen is set to, the layout is always displayed centered ? Erik Schulp www.sgtclog.nl eschulp@-houjerotzooimaar-home.nl -Let's all hope there is intelligent life on other planets, cuz' here on earth, there is bugger all!- *Monty Python* |
#3
| ||||
| ||||
|
|
Nikolaos Giannopoulos wrote: #wrap {text-align: center} #wrapit {text-align: left; margin: auto auto; width: 100%} margin: auto would suffice |
|
The wrap is needed to address an IE5 bug - wrapit is used for conforming browsers wherein the margin: auto (for at least left and right) and the explicit width help center the content. Note that width set to 100%, the div won't be centered, it will extend from one side of the window to the other. |
|
I'd recommend setting a width in em units, and set a max-width to avoid horizontal scroll bar, but max-width doesn't work with MSIE 5.x. ![]() |
|
#wrap { text-align: center; } #wrapit { text-align: left; margin: auto; width: 55em; max-width: 95%; } You could set the width to auto and specify a margin instead. #wrap { text-align: center; } #wrapit { text-align: left; margin: auto 5% ; } or margin: auto 2em or auto 5px or whatever suits you. |
#4
| |||
| |||
|
|
Nikolaos Giannopoulos wrote: My personal site uses a max-width of 55em. I think you didn't read what I wrote, even though you quoted it above. |
|
I set *max-width* to 55em on the body element of my site, and *not* the width. |
![]() |
| Thread Tools | |
| Display Modes | |
| |