我有充滿MySQL數據的框。當鼠標懸停在盒子上方時,它會變大,但下面一行中的盒子會在頁面上移動。我很確定這是由於重疊的元素,但我不知道如何解決這個問題,因爲它們在技術上都是一個元素。重疊元素錯誤
CSS
.boxed {
border: 5px solid blue;
margin-left:30px;
margin-top:10px;
height: 120px;
width: 200px;
border-style: double;
text-overflow: ellipsis;
float:left;
}
.boxed:hover{
height: 150px;
width: 250px;
-moz-box-shadow: 0 0 10px #ccc;
-webkit-box-shadow: 0 0 20px #ccc;
box-shadow: 0 0 20px #888888;
border-style: double;
text-overflow: ellipsis;
}
PHP
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$selection = "ORDER BY id ASC";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) {
die('Could not connect: ' . mysql_error());
}
$selection = isset($_GET['sort']) ? $_GET['sort'] : "";
if ($selection == "1") {
$selection = "ORDER BY id DESC";
} else if ($selection == "2") {
$selection = "ORDER BY id ASC";
}
$sql = "SELECT id, threadName, message FROM threads ";
$sql .= $selection;
mysql_select_db('threads');
$retval = mysql_query($sql, $conn);
if(!$retval) {
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) {
$id = $row['id'];
$threadName = $row['threadName'];
$message = $row['message'];
echo "<div class='boxed'><center>".$threadName."<br>".$message."</center></div>";
}
?>
你得到一個機會,看看我的代碼? – symlink