HTML:我想将此段落文本定位到我的页面底部?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17989923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML: I want to position this paragraph text to bottom of my page?
提问by theRadBrad
hi,
嗨,
Currently the text is at the top of my website but i want it bottom;
目前,文本位于我网站的顶部,但我希望它位于底部;
<p style="text-align:relative;">this is best day ever!this is best day ever!this is best day ever!<p>
when i edit it and add text-align:bottom it dosent works!!!!
当我编辑它并添加 text-align:bottom 时它不起作用!!!!
回答by Johnson Smith
Try this code :
试试这个代码:
<html>
<head>
<title>test</title>
</head>
<body>
<div style="position: relative">
<p style="position: fixed; bottom: 0; width:100%; text-align: center"> TEXT YOU WANT
</p>
</div>
</body>
</html>
回答by Abhishek Jain
Try this:
尝试这个:
style="position:absolute; bottom:0px;"
回答by Kevin Bowersox
Absolutely position the element and set its bottom property to 0.
绝对定位元素并将其底部属性设置为 0。
p{
position: absolute;
bottom: 0;
}
Working Examplehttp://jsfiddle.net/zMKbf/
回答by Vaibhav Jain
回答by Salvio
p {
height:200px;
display: table-cell;
vertical-align: bottom;
}
This is a better way...
这是一个更好的方法...
回答by omer
<html>
<head>
<title>test</title>
</head>
<body>
<div style="display: table;">
<p style="display: table-row;vertical-align: bottom; text-align: center"> TEXT YOU WANT
</p>
</div>
</body>
</html>
i found it in this question, http://stackoverflow.com/questions/526035/how-can-i-position-my-div-at-the-bottom-of-its-container/19110204#19110204
in Hashbrown
answer
我在这个问题中找到http://stackoverflow.com/questions/526035/how-can-i-position-my-div-at-the-bottom-of-its-container/19110204#19110204
了Hashbrown
答案