.retour {
display: inline-block;
text-align: right;
font-size: 30px;
position: relative;
bottom: 0;
right: 0;
margin: 20px;
}
.retour a {
background: black;
border: 1px solid grey;
border-radius: 7px;
color: white;
text-decoration: none;
opacity: 0.75;
font-family: impact;
padding: 14px;
}
<div class="retour">
<a href="../index.html">Retour</a>
</div>
<div class="soundcloud">
<iframe width= 50% src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/335992324&
color=#9cb4b6;
auto_play=true;
hide_related=false&
show_comments=true&
show_user=true&
show_reposts=false">
</div>
答案 0 :(得分:0)
只有当此元素位于绝对位置(right
)或已修复时,您才可以通过left
,top
,bottom
和position: absolute
属性定位元素位置(position: fixed
)。我想你想要position: absolute
,所以这里有一个例子(因为你指定了margin: 20px
,所以不在角落里):
.retour {
display: inline-block;
text-align: right;
font-size: 30px;
position: absolute;
bottom: 0;
right: 0;
margin: 20px;
}
.retour a {
background: black;
border: 1px solid grey;
border-radius: 7px;
color: white;
text-decoration: none;
opacity: 0.75;
font-family: impact;
padding: 14px;
}
<div class="retour">
<a href="">test</a>
</div>
滚动与position: absolute
的区别:
body {
height: 1000px;
}
.retour {
display: inline-block;
text-align: right;
font-size: 30px;
position: absolute;
bottom: 0;
right: 0;
margin: 20px;
}
.retour a {
background: black;
border: 1px solid grey;
border-radius: 7px;
color: white;
text-decoration: none;
opacity: 0.75;
font-family: impact;
padding: 14px;
}
<div class="retour">
<a href="">test</a>
</div>
position: fixed
:
body {
height: 1000px;
}
.retour {
display: inline-block;
text-align: right;
font-size: 30px;
position: fixed;
bottom: 0;
right: 0;
margin: 20px;
}
.retour a {
background: black;
border: 1px solid grey;
border-radius: 7px;
color: white;
text-decoration: none;
opacity: 0.75;
font-family: impact;
padding: 14px;
}
<div class="retour">
<a href="">test</a>
</div>