Jump to content

css layout is not working in php but is in html


harkly

Recommended Posts

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>

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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" />

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.