我有一个带有css和php的html页面。但是,该表并未出现在IE中。但它似乎在Firefox和谷歌Chrome中。
表格显示在IE中。
如果我尝试更改表格的css并将表格调高,它将在Firefox和Chrome中消失。
这是代码:
<html>
<body>
<style type="text/css">
.top {
position:absolute;
left:0; right:0;
height: 92px;
}
.left {
position:absolute;
left:0; top:92px; bottom: 0;
width: 178px;
}
.mainmenu {
position:absolute;
margin-left: 20px;
font-size: 20px;
margin-top: 200px;
}
.adduser {
position:absolute;
margin-left: 20px;
font-size: 20px;
margin-top: 250px;
}
.logout {
position:absolute;
margin-left: 20px;
font-size: 20px;
margin-top: 300px;
}
.admin {
position:absolute;
margin-left: 20px;
font-size: 30px;
margin-top: 20px;
}
.top { background: #4169E1; }
.left { background: #4169E1; }
</style>
<div class="top">
TOP
</div>
<div class="left">
LEFT
</div>
<div class="mainmenu">
<a style='text-decoration:none;' href= "index.html"><font color="white"> main menu</font> </a>
</div>
<div class="adduser">
<a style='text-decoration:none;' href= "index.html"><font color="white">add users</font> </a>
</div>
<div class="logout">
<a style='text-decoration:none;' href= "index.html"><font color="white">logout</font> </a>
</div>
<div class="admin">
welcome to admin page
</div>
<table style="margin-top:40px;" border='1' align='center'>
<tr>
<br><th>name</th><br/>
<br><th>username</th></br>
<br><th>remote ip</th></br>
<br><th>login</th></br>
<br><th>Edit</th></br>
<br><th>Change Password</th></br>
<br><th>Delete</th></br>
<h4 style="margin-top:-150px;" align='center'> Users Accounts </h4>
</tr>
<?php
$con=mysqli_connect("localhost","sqldata","sqldata","accounts");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM uptable");
while($row = mysqli_fetch_array($result))
{
echo "
<tr>
<td>{$row['name']}</td>
<td>{$row['username']}</td>
<td>{$row['ip']}</td>
<td>{$row['login']}</td>
<td><a href='edit1.php?username={$row['username']}'>Edit</a></td>
<td><a href='userpwd.php?username={$row['username']}'>Change</a></td>
<td><a href='delete5.php?username={$row['username']}'>Delete</a></td>
</tr>";
}
mysqli_close($con);
?>
</table>
</body>
</html>
答案 0 :(得分:1)
这不是有效的HTML:
<table style="margin-top:40px;" border='1' align='center'>
<tr>
<br><th>name</th><br/>
<br><th>username</th></br>
<br><th>remote ip</th></br>
<br><th>login</th></br>
<br><th>Edit</th></br>
<br><th>Change Password</th></br>
<br><th>Delete</th></br>
<h4 style="margin-top:-150px;" align='center'> Users Accounts </h4>
</tr>
<br>
元素不能包含内容,它代表换行符。
<h4>
不在<th>
或<td>
。