我有一个像这样嵌套在 2 个 div 中的 h4
<div id="my-team-lineup" style="text-align:center">
<div id="myteamDiv" style="width:100%; ">
<div id="myTeamBeforeDiv" style="width:50%; float: left;">
<center>
<h4>Before Trade</h4>
<div class="tableRow header blue" id="statTable0">
<div class="cell">Pos</div>
<div class="cell">Players</div>
<div class="cell">Opp</div>
<div class="cell">Proj Pts</div>
</div>
<div class="tableRow">
<div class="cell">
Text
</div>
<div class="cell">
Text
</div>
<div class="cell">
Text
</div>
<div class="cell">
Text</div>
</div>
<br />
<h4>Week At Bottom</h4>
</center>
</div>
</div>
我想让这个 h4 粘在页面底部。我已经尝试了我能想到的所有位置和底部组合,但没有任何效果。请注意,因为我有一个完全相同的复制品,它占据了页面的另外 50%,而且 div 的高度可能因内容而异。
最佳答案
首先,您没有关闭代码中的所有 div。更正一下。
可以设置position为fixed,bottom为0。
HTML
<h4>text</h4>
CSS
h4{
position: fixed;
bottom: 0;
}
关于css - 将 Div 中的文本粘在窗口底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39908574/