7

目前文本位于我网站的顶部,但我希望它位于底部;

 <p style="text-align:relative;">this is best day ever!this is best day ever!this is best day ever!<p> 

当我编辑它并添加 text-align:bottom 时它会起作用!!!!

4

6 回答 6

14

试试这个代码:

  <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>

于 2013-08-01T09:30:53.270 回答
0

尝试这个:

style="position:absolute; bottom:0px;"
于 2013-08-01T09:19:58.520 回答
0

绝对定位元素并将其底部属性设置为 0。

p{
    position: absolute;
    bottom: 0;
}

工作示例 http://jsfiddle.net/zMKbf/

于 2013-08-01T09:20:45.407 回答
0
 <p id="Bottom">this is best day ever!this is best day ever!this is best day ever!<p> 

和 CSS :

#Bottom {
   position : absolute;
   bottom : 0;
}

演示

于 2013-08-01T09:21:38.990 回答
0
p {
    height:200px;
    display: table-cell;
    vertical-align: bottom;
}

这是一个更好的方法...

于 2016-12-03T11:34:31.073 回答
0
 <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>

我在这个问题中找到http://stackoverflow.com/questions/526035/how-can-i-position-my-div-at-the-bottom-of-its-container/19110204#19110204Hashbrown答案

于 2017-03-15T09:42:11.250 回答