Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting to XHTML becomes layout disaster

Status
Not open for further replies.

quickling

Programmer
Apr 13, 2005
3
US
Hi, a newbie question probably. I'm just converting an HTML codebase to XHTML. I've followed standard tips for moving to HTML 4.01, and then included the !DOCTYPE tag. I ran my test page thru Tidy with -asxhtml and it now verifies with no errors. But the page itself displays *completely* differently now.

The stylesheet is definitely loaded, cuz the background specified in body { } shows up. Colors are correct, but the layout is destroyed, with all requested div dimensions ignored, as well as border-widths, padding and margins. Even the font-family and font-size styles are ignored! The css file is actually a php file, but it is specified as text/css in the http header, and it works beautifully in IE, Mozilla, Safari and Camino. But once I add the DOCTYPE, everything goes wrong.

Many thanks to anyone who can help!
-jesse

Here's some relevant code:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]

<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
(...snip...)

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="common/primary_css.php" type="text/css" media="screen" />

(...snip...)
</head>
 
You'll need to either post a complete link to the css file or post the code here so we can look at it.

Mike Krausnick
Dublin, California
 
I'm away from that code at the moment but I'll post it asap. In the meantime, I checked my CSS and realized that in quite a few places I'd left the units off, e.g. "border-width: 4;". Does the XHTML doc-type make the CSS get interpreted more strictly, so that units must be included (rather than defaulting to pixels, as I normally expect)?

thanks,
jesse
 

In FF, yes - units ARE required.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Yes -- that was my entire problem!

thanks Mike and Dan,
you've made a newbie happy.

jesse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top