我下面顯示QR代碼的PHP代碼&我在提交密碼的中心顯示它。現在,由於我將它放在中間,頁面的其餘部分顯示爲白色&我希望整個瀏覽器背景顏色都是藍色。我試圖把的bgcolor但只改變中間部分的背景,其中圖像出現&我需要整個瀏覽器的背景顏色爲藍色HTML頁面生成QR碼的背景顏色
這裏是我的參考代碼:
<!DOCTYPE HTML>
<html>
<head>
<style>
.error {color: #FF0000;}
html, body {
height: 100%;
}
html {
display: table;
margin: auto;
}
body {
vertical-align: middle;
}
</style>
</head>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// reading from post
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table width="380px">
<tr>
<td valign="top">Password:</td>
<td><input type="text" name="password" value="<?php echo $password; ?>"><span class="error">* <?php echo $passwordErr;?></span></td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" name="submit" value="Submit">
</td>
</tr>
</table>
</form>
<?php
if ($password) {
echo "<img src='./myqrcode.php?password=$password' />";
?>
</body>
</html>
任何一個可以告訴我如何把藍色作爲背景?
謝謝
你試過這樣的:'background-color:blue;'到'body'元素,它仍然不起作用?只要確保'body'元素沒有任何默認邊距或填充。 – 2014-11-05 05:16:58