1 Replies - 536 Views - Last Post: 26 August 2015 - 03:29 PM

#1 MarcHinton   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 27-April 15

CSS Background Image Not Showing...

Posted 26 August 2015 - 03:10 PM

I recently took on a freelance project and I have been having some trouble with the background-image property. I have the code:

html {
	background: url(../images/home-backgroun) no-repeat center center fixed;
	-webkit-background-size: cover;
	-moz-background-size: cover;
	-o-background-size: cover;
	background-size: cover;

and it only seems to work when it wants to. I refresh and refresh my preview in my browser and I'd say once in every 20 refreshes, the background image is there. I have checked and checked and changed and re-checked all of the file directories and changed "html" to "body" and everything else I can think of. I took away all other CSS properties but the body background url and it still did the same thing. I uploaded it to my server and it did the same thing. It's not just a preview glitch and it happens on my 1080 monitor as well as the display on my iPad and iPhone.

I also tried just making a div with an img tag and this worked except for scaling and stuff which was terrible but was solved by the code above (when it decided to work). I have changed the image to 100's of different images, both local and using www.image.com/image.jpg kind of methods. There just doesn't seem to be a fix to this issue and it's annoying the hell out of me, I wish if it was messing up it would still be consistent and either show up or not show up.

If anyone has any suggestions then please let me know because I'm really desperate at this point. It's supposed to be so easy :whatsthat:

Is This A Good Question/Topic? 0
  • +

Replies To: CSS Background Image Not Showing...

#2 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6912
  • View blog
  • Posts: 28,592
  • Joined: 12-December 12

Re: CSS Background Image Not Showing...

Posted 26 August 2015 - 03:29 PM

I always surround the url with apostrophes, even though it works without ;)

But why doesn't your image have an image extension?
And is it a very large image?

This SO topic confirms that it should be possible to supply an image without an extension. Personally, I wouldn't do this. Even if it loads reliably I'd be suspicious about performance (and different devices, and..).

This post has been edited by andrewsw: 26 August 2015 - 03:30 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1