绝对定位div未显示背景图像

时间:2015-11-11 13:24:58

标签: html css

我正在尝试显示绝对定位的div的背景图像。但那个div永远不会炫耀.. fiddle here

<div class=""> City: 
    <span class="displaycity" style="display: none;">xxxx 
    </span> 
    <span class="contentbox editcitytext" style="display: inline-block;"> 
        <input type="text" value="xxxx" class="citynamebox"> 
        <div style="position: absolute; color: brown; z-index: 3333; top: -101px; left: 90px;" class="validationmessagecomposed">
            <div style=" border:1px solid brown; padding:10px;background-color:white;">Please check for invalid characters
            </div>
            <div style="height:7px;  text-align:center;background- image:url(https://upload.wikimedia.org/wikipedia/commons/2/21/Ic_arrow_drop_ down_48px.svg); background-repeat:no-repeat;background-position:60px; position:absolute; top:93px;">
            </div>
        </div> 
    </span> 
    <span class="editcitybutton">Update 
    </span> 
</div>

1 个答案:

答案 0 :(得分:0)

很难确定 - 但是你永远不会设置一个宽度,这对于绝对定位的div来说是必需的。尝试向div添加边框以查看它是否具有宽度/高度。