0

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:

<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:

.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

9
  • 1
    here's a fiddle that's working fine using your code, I just changed the background url: jsfiddle.net/wpsmbxuu what issue are you having? Commented Apr 19, 2015 at 3:26
  • Maybe your other CSS is overriding this, because it is more specific. Commented Apr 19, 2015 at 3:27
  • learn something about browser devtools Commented Apr 19, 2015 at 3:31
  • I'm testing it on my WAMP server Commented Apr 19, 2015 at 3:34
  • And it was not working tried all possible things Commented Apr 19, 2015 at 3:35

1 Answer 1

1

Just add http:// before the image locating in your webserver like this http://img/logo.png and it will start working.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.