-1
的我理解为什么设置文本对齐属性权值的问题,将span标签移出锚标签区域(溢出)?为什么设置文本对齐,以正确的定位标记,移动跨度标签,它是锚定标记,移出锚标记
HTML文档
a.btn{
border: 1px solid #00A0D6;
border-radius: 30px;
background-color: #00A0D6;
text-decoration: none;
color: white;
text-align: right;
width: 250px;
height: 20px;
position: relative;
display: inline-block;
margin: auto;
}
.container{
margin: 90px;
}
.top-content{
position: absolute;
text-align: center;
}
.bottom-content{
position: absolute;
top: 100px;
}
<a href="#" class="btn">
<span class="top-content">Buy now</span>
<span class="bottom-content">Sale for $40</span>
</a>
我甚至不能正确居中的跨度标签的结构。我不懂为什么?
是的,它可以工作,但我想要绝对位置的跨度标签。 – forethought
好@foreforet我更新我的答案 – Anfuca
我知道为什么被定位到正确的位置时,我将位置设置为绝对? – forethought