我有一个div
用于我的标题和该div中的文本。现在我已经想出了如何将该文本放在div
的底部,但我似乎无法将其放在中心位置。在div底部放置一个文本
text-align: center;
没有工作。
#heading {
position: relative;
background: -webkit-linear-gradient(#acbfb9,#cae1da); /* For Safari */
background: -o-linear-gradient(#acbfb9,#cae1da); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#acbfb9,#cae1da); /* For Firefox 3.6 to 15 */
background: linear-gradient(#acbfb9,#cae1da);
height: 150px;
width: 100%;
}
#title {
position: absolute;
bottom: 20px;
}
<div id="heading">
<h1 id="title">StrAgility</h1>
</div>
你能提供你的HTML吗? –
加'left:0; right:0' .... – NoobEditor
最好把html放在下 –