2016-11-14 96 views
1

喜右下角我有一个问题我的代码看起来像这样(我是一个起动机)的Html麻烦对准

<div class="backtotop"> 
     <a href="#top"> 
      Back to top&circ; 
     </a> 
    </div> 

和我的样式表有

.backtotop{ 
    font-size: 30px; 
    width: 20%; 
    background-color: #b6aeac; 
    text-align: right bottom; 
} 

a{ 
    text-decoration: none; 
    font-size:30px; 
    font-style: normal; 
    color: #23285a; 

} 

但它不对齐 我想显示在页面的右下角,但我不希望它被修复。
The picture of absolute code used 其返回顶部底部我在做

+0

请提供一个例子,你在jsFiddle后。似乎这个问题还不清楚,因为两个人已经给了你答案,这对你的任务并没有真正的帮助。 – Narxx

回答

-1

使用此代码在网页中的

position: fixed; 
    bottom: 0; 
    right: 0; 

CSS右下角检查snippest:

.backtotop{ 
 
    font-size: 30px; 
 
    width: 20%; 
 
    background-color: #b6aeac; 
 
    position: fixed; 
 
    bottom: 0; 
 
    right: 0; 
 
} 
 
a{ 
 
    text-decoration: none; 
 
    font-size:30px; 
 
    font-style: normal; 
 
    color: #23285a; 
 

 
}
<div class="backtotop"> 
 
     <a href="#top"> 
 
      Back to top&circ; 
 
     </a> 
 
    </div>

已更新:

结帐这通过使用position:absolute

.backtotop{ 
 
    font-size: 30px; 
 
    width: 20%; 
 
    background-color: #b6aeac; 
 
    position: absolute; 
 
    right: 0; 
 
    bottom: 0; 
 
} 
 
a{ 
 
    text-decoration: none; 
 
    font-size:30px; 
 
    font-style: normal; 
 
    color: #23285a; 
 

 
}
<div class="backtotop"> 
 
     <a href="#top"> 
 
      Back to top&circ; 
 
     </a> 
 
    </div>

更新2:

如果您想在中心的div然后取出bottom:0并添加top:50%; 这样的:

.backtotop{ 
    font-size: 30px; 
    width: 20%; 
    background-color: #b6aeac; 
    position: absolute; 
    right: 0; 
    top:50%; 
    //bottom: 0; 
} 

如果修复您想要显示BacktoTop类到学院名称的确切位置,那么只需在右边对齐div即可,如果您使用表格结构,那么文本对齐:右对齐。

我的这会对你有帮助。

仍然问如果你有任何疑问。

+0

问题说“我不希望它被修复”。 – Quentin

+0

thx它帮助我,但它的固定 –

+0

我希望它在页面的右下角,但不是固定它应该在我的文章结尾 –

-1
.backtotop { 
    font-size: 30px; 
    width: 20%; 
    background-color: #b6aeac; 
    position: fixed; 
    bottom: 0; // adjust as per need 
    right: 0; // adjust as per need 
} 
+0

问题说:“我不希望它被修复”,这也是更像是一场不同寻常的游戏的问题。你应该解释你改变了什么,以及为什么它应该解决问题(理想情况下链接到文档)。 – Quentin