我在我的頁面上有一個我想要應用背景圖像的按鈕。爲什麼我的背景圖片不顯示?
當我有下面的代碼,它不適用。誰能解釋爲什麼?
演示:https://jsfiddle.net/p7octep1/
.form-file-upload .close {
display: block;
position: absolute;
top: -13px;
right: -13px;
width: 26px;
height: 26px;
font-size: 18px;
text-align: center;
line-height: 26px;
z-index: 3;
border: 0;
background: url(http://placehold.it/26x26) 0 0 no-repeat;
}
<div class="form-file-upload">
<button type="button" class="close"></button>
</div>
爲什麼你使用'的位置是:絕對的;'和'頂部和right'與'-13px' –
你上面的代碼工作,只需用'位置:相對;直接父母。 –