View Full Version : Strange XHTML error when page smaller than screen
danep
09-07-2006, 05:10 AM
Rather than describing this all and trying to troubleshoot, just check out the page (http://www.riceoutdoorsclub.org/gear.php?geartype=Misc) in Firefox. (It will only be served up in XHTML to browsers which prefer it, so Firefox but not IE)
When the page is served in HTML 4.01, everything looks fine. But as XHTML, you should see a huge whitespace below the content, where the page just seems to "stop". I'm sure I'm overlooking something simple... like a missing "background" attribute... but I can't for the life of me figure out what it is!
Any help would be appreciated. Thanks in advance!
_Aerospace_Eng_
09-07-2006, 05:16 AM
What is the script you are using to pass the correct header to the browsers that support them?
danep
09-07-2006, 05:56 AM
I use this script (http://keystonewebsites.com/articles/mime_type.php):
<?php
$charset = "iso-8859-1";
$mime = "text/html";
function fix_code($buffer) {
return (preg_replace("!\s*/>!", ">", $buffer));
}
if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {
if(preg_match("/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
$xhtml_q = $matches[1];
if(preg_match("/text\/html;q=q=([01]|0\.\d{1,3}|1\.0)/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
$html_q = $matches[1];
if((float)$xhtml_q >= (float)$html_q) {
$mime = "application/xhtml+xml";
}
}
} else {
$mime = "application/xhtml+xml";
}
}
if($mime == "application/xhtml+xml") {
$prolog_type = "<?xml version=\"1.0\" encoding=\"$charset\" ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
} else {
ob_start("fix_code");
$prolog_type = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html lang=\"en\">\n";
}
header("Content-Type: $mime;charset=$charset");
header("Vary: Accept");
print $prolog_type;
?>
I'm in the process of converting to XHTML, so only certain pages include this. The rest are served solely as HTML 4.01.
Alex Vincent
09-07-2006, 08:15 AM
I'm pretty certain this is a CSS problem, not a XML problem. For instance, when I use DOM Inspector to set min-height to 1024px, the grey background gets much bigger. Also, when I set the background-color property on the HTML element (and not the BODY element), it fills the whole screen.
Moving to HTML / CSS forum.
danep
09-08-2006, 02:20 PM
Hah.. you're right. I set the background color on the HTML element instead of the BODY element and it works fine.. and I'm pretty sure that's legal. Thanks for the input!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.