我网站的表单页面上有 3 个 div。每当我单击切换按钮时,左上角的切换与底部 div 重叠。
我想要做的是,当单击顶部 div 容器时,左下角的 div 容器应该向下移动,并在切换关闭时移回原来的位置。
我已经包含了正确 div 的 css,我不知道这是否是影响它旁边两个 div 位置的 css。
切换前
切换后
切换的 CSS
#toggle-view {
list-style:none;
font-family:arial;
font-size:10px;
margin:0;
padding:0;
width:200px;
position: absolute;
}
#toggle-view li {
list-style:none;
text-decoration:none;
font-size:13px;
font-family:'lato';
padding:2px;
margin:10px;
margin-left:20px;
position:relative;
cursor:pointer;
border-radius: 5px;
}
#toggle-view li a:hover {
color: brown;
}
#toggle-view h3 {
margin:0;
font-size:13px;
color:#2a5a9a;
}
#toggle-view span {
position:absolute;
right:5px; top:0;
color:#2a5a9a;
font-size:20px;
font-weight: bolder;
}
#toggle-view p {
margin:5px 0;
display:none;
}
#toggle-view a{
padding:5px 0;
color:#35371c;
}
#toggle-view a:hover{
color:#2a5a9a;
}
左框的 CSS
.report{
position: absolute;
margin-top:100px;
margin-left:0;
padding-left: 20px;
}
右框的 CSS
.register-body {
height:auto;
font-size:1em;
width:710px;
position:relative;
color:#000;
border-radius:5px;
background-color:#d2d4bb;
line-height:20px;
margin:20px 0 20px 250px;
padding:15px 15px 0;
}
当我改变
#toggle-view {
position: absolute;
}
至
#toggle-view {
position: relative;
}
和
.report{
position: absolute;
}
至
.report{
position: relative;
}
我懂了 :
右框被推到左下框下方。
更新
我的HTML
对于切换:
<ul id="toggle-view">
<li>
<h3>Create View Comment</h3>
<span>+</span>
<p>
<a href="forum.php">Forum Homepage </a><br>
<a href="create-topic.php">Create Topic </a><br>
<a href="view-topic.php">View Topics</a><br>
<a href="forum-stat.php">Forum Stats</a><br>
</p>
</li>
对于左下形式
<div class='headword'>Report A User</div>
p>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<?php
$user = mysql_query("SELECT forum_id, username, first_name, last_name, email
FROM forum_login ORDER BY username ASC") or die(mysql_error());
echo"User <select name='username' class='tap_Select' title='User You Want To Report'>
<option value =''> </option>";
while($row1 = mysql_fetch_array($user)){
echo '<option value="'.$row1['username'].'">'.$row1['username'].'</option>';}
echo '</select>' ; ?><br>
<select name="type" class="tap_Select" title='What Are You Reporting For'>
<option value =""> </option>
<option value ="bullying">Bullying</option>
<option value ="trolling">Trolling</option>
<option value ="spamming">Spamming</option>
</select>
<br>
<textarea type="text" name="desc" style="width:150px ; height: 100px;">
</textarea><br>
<input type="submit" name="submit1" class="tap1_Btn">
</form>