...

View Full Version : Dynamic Height Div



Erindesign
09-18-2007, 03:24 AM
Hey all,

Made a not-so-common layout for one of my sites. It's about 300px high and 100% wide. SInce its a Horizontal page, I want it to be centered in the browser.

I was thinking of putting 3 divs, being that the middle one has a static height and the other two have the difference split in two in order to keep the middle div centered vertically.

any ideas on how?

PremiumBlend
09-18-2007, 03:40 AM
This should work for you. You must use this Doctype or it won't work in IE 7.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body style="margin:0;padding:0;">
<div style="height: 300px; width: 600px; margin: 0 auto; background-color: gainsboro;">Test</div>
</body>
</html>

jlhaslip
09-18-2007, 01:47 PM
Vertically centred, 100% width? this should work for you...

Attached html file. Drop the txt extension.

PremiumBlend
09-19-2007, 03:02 AM
centered vertically.

Sorry, I wasn't paying close enough attention I guess.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum