在下面的例子:絕對定位範圍內的文本,而不是外部?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Test Button</title>
<style type="text/css">
.myline {
background-color: #FFF;
width: 96%;
padding-left: 2%;
padding-right: 2%;
height: 8vh;
padding-top: 0vh;
border-bottom: 0.3vh black;
border-style: none none solid none;
font-size: 0.9em;
line-height: 8vh;
position:relative;
}
span.testbutton {
width: 5em;
height: 1.5em;
display: inline;
position: absolute;
top: 50%;
right: 0;
margin-top: -0.75em;
background-color: #EEE;
font-size: 0.9em;
}
</style>
</head>
<body>
<div class="myline">
<span class="testbutton">DO IT</span>
</div>
</body>
</html>
...我希望文字的<span>
內呈現,但是這是火狐44如何呈現它:
曾經出現在上面的圖片,文字是下面的<span>
- 不在裏面,就像我預料的那樣?
如果我從span.testbutton
中刪除position:absolute;
,那麼文本就在裏面 - 但是我也不能使用right:0;
。
我該如何修復我的代碼,以便在span內的文本位置?
它的工作原理@PhiterFernandes - 非常感謝!將代碼添加到'span.testbutton'類中......我在倒計數到期後立即接受這個':''乾杯! – sdaau
很高興我可以幫助:) – Phiter