harkly Posted May 28, 2009 Share Posted May 28, 2009 I cannot get my css layout to work on my php page, it works fine if I change to a HTML extension. Is there is difference in how we code when working with php?? Or can someone see what I am doing wrong? Just using a simple layout My css code: /* ----------container to center the layout-------------- */ #wrapper{width:1200px; background-color: #cfc;} #header {width:1200px; background-color: #ccc; border: 1px solid #ccc; height: 100px;} #leftcolumn{border: 1px solid #ccc; width:800px; background-color: #cff; float: left;} #rightcolumn{float:right; width:400px;} #footer {width:1200px; background-color: #ccc; border: 1px solid #ccc; height: 10px;} #form {float:left; width:800px; background-color: #fcc;} #nav2 {float:left; width:800px;} php/html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="admin.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" media="print" type="text/css" href="../print.css" /> <title>The Art Database - Admin Console</title> </head> <body> <?php include("../library/login.php"); login(); ?> <div id='container'> <div id='header'><h3>The Backend</h3></div> <div id='wrapper'> <div id='leftcolumn'> <div id='nav'>Navigation</div> <div id='form'>Left Form Pink</div> </div> <div id='rightcolumn'>Right</div> </div> <div align="center">Footer</div> </div> </body></html> Quote Link to comment Share on other sites More sharing options...
harkly Posted May 29, 2009 Author Share Posted May 29, 2009 also tried this <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="admin.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" media="print" type="text/css" href="../print.css" /> <title>The Art Database - Admin Console</title> </head> <body> <?php echo "<div id='wrapper'>"; echo "<div id='header'>This is the Header</div>"; echo "<div id='leftcolumn'>Left</div>"; echo "<div id='rightcolumn'>Right</div>"; echo "</div>"; echo "<div id='footer'>footer</div>"; ?> </body></html> Quote Link to comment Share on other sites More sharing options...
SuperBlue Posted May 30, 2009 Share Posted May 30, 2009 No there isn't any difference, but you should remember to close your elements when working with XHTML, as well as serve your page with the correct mime type. Also you can't have anything before the doctype, not even a space or a linebreak. The doctype should be the first line in your page. So the below: <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Should be changed into: <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> And <link href="admin.css" rel="stylesheet" type="text/css"> to <link rel="stylesheet" type="text/css" href="admin.css" /> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.