我在我的页面上有一个我想要应用背景图像的按钮。为什么我的背景图片不显示?
当我有下面的代码,它不适用。谁能解释为什么?
演示: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' –
你上面的代码工作,只需用'位置:相对;直接父母。 –