由於某些原因,我的CSS不會將我的div標籤格式化爲頁面上的正確位置。它適用於我所有的其他頁面,但是這個頁面比正常頁面有更多的PHP,我想知道這是否是問題所在。 頁PHP,HTML和CSS的頁面佈局問題
<!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>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
require("protect/serverInfo.php");
$myusername=$_POST[Email];
$mypassword=$_POST[Password];
$result = mysql_query("SELECT * FROM Customers WHERE Email='$myusername' AND Password=$mypassword");
$count=mysql_num_rows($result);
if($count==1){
while($row = mysql_fetch_array($result)){
?>
<div class="wrapper">
<div class="customerHead">';
<h1>
<?php echo $row['Customer'] ?>
</h1>
</div>
<div class="customerInfoMain">
Company: <?php echo $row['Company'] ?><br />
State: <?php echo $row['State'] ?>
</div>
<div class="customerCards">';
<a href ="something/<?php echo $row['imagePathFront'] ?>" target="_blank"><img src="<?php echo $row['imagePathFront'] ?>" width="400px" height="303px" align="center" alt="" /></a>
<a href ="something/<?php echo $row['imagePathBack'] ?>" target="_blank"><img src="<?php echo $row['imagePathBack'] ?>" width="400px" height="303px" align="center" alt="" /></a>
</div>
<div class="customerComments">';
<h5>Changes Made:</h5><br /> <?php echo $row['Comments'] ?>
</div>
</div>
<?php
}
}
else {
echo "Wrong Username or Password";
}
?>
</body>
</html
>
CSS
來源頁面加載後.customerCards{
top: 150px;
position: relative;
width: 425px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:1;
}
.customerInfoMain{
top: 200px;
position: relative;
width: 200px;
left: 520px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:2;
}
.customerComments{
position: relative;
width: 200px;
left: 580px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:2;
}
.wrapper{
position: absolute;
left: 50%;
width: 900px;
margin-left: -475px;
}
<!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>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
Wrong Username or Password
</body>
</html>
PHP在服務器端運行,並且從不出現在輸出中。您需要查看生成的HTML(並可能在此處發佈) – 2011-02-01 08:04:13