[英]Align to bottom and center horizontally?
我有一個模式,我希望頁碼在模式的底部並居中對齊。
頁碼的絕對位置是底部0,中間是文本對齊:
#pagination{
background: blue;
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
問題是,我將頁碼設置為100%的寬度(以便它們可以居中對齊),但這要考慮到模式填充(我不能更改此設置),因此頁碼剛好偏離中心並偏離了頁。
嘗試添加left:0;
給你的代碼
#pagination {
background: none repeat scroll 0 0 blue;
bottom: 0;
left: 0;/*add this*/
position: absolute;
width: 100%;
}
像這樣的演示,添加left:0
以及bottom:0
和position:absolute
CSS:
#pagination {
background: blue;
position: absolute;
bottom: 0;
width:100%;
left:0;
}
而不是使用width:100%;
嘗試使用
#pagination{
background: blue;
position: absolute;
bottom: 0;
left:0;
right:0;
}
這樣,如果需要,您可以在#pagination
添加填充
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.