CSS background image not working

空扰寡人 提交于 2019-12-11 09:01:56

问题


I have a modal demo here (fiddle)...

When it comes up, the background image for the modal window shows up. However, in this code below, you'll see I have a background image for the close window function. It's not showing up and I don't understand why. The CSS should have it showing in the top, right-hand corner.

.reveal-modal .close-reveal-modal {
    background: #eee url(http://webfro.gs/south/kb2/images/broken_link.png) no-repeat;
    position: absolute;
    top: 50px;
    right: 100px;
    text-shadow: 0 -1px 1px rbga(0,0,0,.6);
    cursor: pointer;
    } 

回答1:


You div has no content, so you need to add a height and width:

.reveal-modal .close-reveal-modal {
    background: #eee url(http://webfro.gs/south/kb2/images/broken_link.png) no-repeat;
    position: absolute;
    top: 50px;
    right: 100px;
    text-shadow: 0 -1px 1px rbga(0,0,0,.6);
    cursor: pointer;
    height:50px;
    width:50px;
    } 

50px is probably too much



来源:https://stackoverflow.com/questions/18767969/css-background-image-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!