简体   繁体   English

CSS不显示背景图片

[英]background image not displayed with css

I want to set background image and it is not working. 我想设置背景图像,但它不起作用。 I dont know what the problem is but it just not working please help me out. 我不知道问题是什么,但它不能正常工作,请帮帮我。

html code is: html代码是:

<div class="main">
    <div class="header clearfix">
<div class="container">
    <div class="left-header">


        <a href="" title="Home" class="ann"><div class="logo"></div></a>
        <div class="fb-like" data-href="https://www.facebook.com/pages" data-layout="button_count" data-action="like" data-show-faces="true" data-share="false"></div>
    </div>

  </div>
</div>

My css is: 我的CSS是:

.logo{
background: url("img/logo.png") no-repeat center center; 
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
width: 201px;
margin-left: 10px;
height: 76px;
margin-top: 19px;
transition:all .3s;
-webkit-transition:all .3s;
-moz-transition:all .3s;
-ms-transition:all .3s;
-o-transition:all .3s;
}

And my image size is 231*86px hope u will find the answer and post it 我的图片尺寸为231 * 86px,希望您能找到答案并将其发布

只需在图像中将http://之前添加http:// ,像http://img/logo.png ,它将开始工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM