我尝试使用position:fixed在页面底部将两个div粘在一起。问题是当我在#febackbackTab上添加填充时,它会从页面底部重复#feedbackTab到我想要的地方。如何在#feedbackBody之上安装#feedbackTab并将它们都固定在页面底部?
#feedbackTab {
background-image:url(../img/feedback_12.png);
position:fixed;
bottom:0px;
padding-bottom:300px;
margin:0;
width:960px;
height:34px;
}
#feedbackBody {
background-image:url(../img/Feedback_bkg_14.png);
position:fixed;
bottom:0px;
width:960px;
height:292px;
margin:0;
}
<div id="feedback">
<div id="feedbackTab"></div>
<div id="feedbackBody">
<div id="comments">
<h2>Comments/Suggestions</h2>
<input class="commentsTxt" type="text" name="Comments"><br \>
<input id="commentsSubmit" type="submit" value="Submit">
</div><!-- end comments -->
<div id="problems">
<h2>Problems?</h2><br \>
<label id="email">Email:</label><input class="emailBox" type="text" name="Email"><br \>
<label id="problem">Problem: </label><input class="problemBox" type="text" name="Comments"><br \>
<input id="problemsSubmit" type="submit" value="Submit">
</div><!-- end problems -->
</div><!-- end feedbackBody -->
</div><!-- end feedback -->
答案 0 :(得分:2)
我会将它们放在一个容器div中,以便将所有内容组合在一起:
CSS:
#tabContainer{
width:700px;
}
.tab{
width:100px;
text-align:center;
float:left;
margin-right:2px;
}
#feedbackTab{
background-color:red;
}
#tab2{
background-color:green;
}
#tab3{
background-color:yellow;
}
#feedbackBody{
clear:both;
width:100%;
height:500px;
background-color:blue;
}
HTML:
<div id="tabContainer">
<div id="feedbackTab" class="tab">FeedBack</div>
<div id="tab2" class="tab">Tab2</div>
<div id="tab3" class="tab">Tab3</div>
<div id="feedbackBody">
This is the feedback body
<br/>lorem ipsum
<br/>
<input type="button" value="button">
</div>
</div>
</body>
不幸的是,JSFiddle现在似乎已经失败,所以我不能嘲笑它或为你测试它。我希望这会有所帮助!
编辑:我找到了替代试验台:http://cssdesk.com/y7Hb2