• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Html/CSS coding question

Xenos

Member
How does one code a web page html/css to ensure that when the maximize button is pressed the page drops into the middle of the computer screen instead of settling to the left or right side of the screen? Assuming the page fits onto a colored background.
 
Thanks buddy, works perfectly in chrome and firefox; still cant get it to work in ie. As you said problem seems to be in the doctype declaration. Tried it in 'transitional 4.0' as well as without, e.g. html 4.01.
 
You should use the XHTML Strict DOCTYPE, you might try that. If not it's better to write XHTML anyways. 🙂

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


If it doesn't work, then you can use text-align: center;

Like this:

HTML:

<div class="outerContainer">
<div class="innerContainer">
<p>Your Stuff</p>
</div>
</div>

CSS:

div.outerContainer { width: 980px; margin: 0 auto; text-align: center; } /* This will center the outerContainer in IE6, obviously set the width to whatever you want */
div.outerContainer div.innerContainer { text-align: left; }

You can use two divs for this because that way the 2nd div (innerContainer) will reset the text-align property to 'left'. You can also put floats etc on the innerContainer. That's how I usually do it anyways.

But for IE7, I know that when using the XHTML Strict DOCTYPE, you don't need text-align: center, the margin: 0 auto will work. Sometimes it works in IE6 too... lol but I've seen IE6 not work for whatever reason. Infact I've seen it do unbelievable things. IE6 is a ridiculous browser by today's standards.

Anyways, that should help.
 
Thanks LightningRider, am running IE7 right now, will look into the differences 'tween html and xhtml and convert to latter. Seems the way to go. Will try yr suggestions when I get off from work.
 
Back
Top