我希望在具有背景的按鈕上顯示一些文字。然而,這不能與絕對位置綁定,因爲我要在屏幕的多個部分重複使用此按鈕,只更改我正在顯示的文本。帶有css的ImageButton上的文字
此刻,我有以下幾點: -
<div class="ReportButton">
<div class="ReportImageButton">
<asp:Image runat="server" ImageUrl="Images/button_arrow.png" ID="ImgReportButton" ImageAlign="AbsMiddle" Height="40px" />
</div>
<div class="ReportImageButtonText">Text Goes Here</div>
</div>
和CSS:
.ReportButton {
width: 100px;
height: 40px;
}
.ReportImageButton {
height: 40px;
position: absolute;
}
.ReportImageButtonText {
height: 40px;
z-index: 100;
position: absolute;
color: white;
font-size: 12px;
font-weight: bold;
left: 330px;
top: 330px;
}
這工作得很好,但是我希望避免使用,如果可能的絕對位置,爲我所陳述的理由之前。
可能嗎?
刪除你在'ReportImageButtonText'類擁有的一切,它會正常工作 – enb081 2013-05-07 09:36:45
@Johann如果您喜歡的托馬斯·W上的答案,請接受它,以便我們都知道這個問題是回答和完成的。謝謝。 – 2013-05-07 10:23:08