100% height div with xhtml

  • Thread starter Thread starter Jeremy Chapman
  • Start date Start date
J

Jeremy Chapman

If my page has a doc type tag of:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

How do I create a div that sizes it's height to 100% of the page?

For example:
<div style="height:100%"></div> will not size to fit the page height, but
if I remove the DOCTYPE tag or set it to something other than XHTML the div
will resize.
 
Use a Stylesheet and create a class or set the width for the div tag. That
should work. Moving forward this is the best time to clean up.

Regards,

Trevor Benedict R
MCSD
 
xhtml (or html 4.0) does not support this. there is no default height for a
page (unlike width). your div has to be contained inside an html object with
an absolute height.

-- bruce (sqlwork.com)
 
Back
Top