Background img | SoloLearn: Learn to code for FREE!


Background img

Hello. Does someone have a clue why background: url image in css does display on bracket's live preview but do not show in any other browser?? :-(

8/3/2017 10:01:13 PM

Maciej Mazurek

7 Answers

New Answer


It doesn't help:-( my css code is: header { background: url(/img/man-1.jpg) no-repeat center center; background-size:cover; width:100%; height:100vh; position absolute; } On live preview everything is fine but when i pushed my project on github and try to display in od githubpages, background dont no want to show... Then i tried to open index.htm on Chrome and Firefox and dont work as well...


Everything is fine with the CSS, except I am a little suspicious about that url(), you need to make sure that it points to the image.


Are you sure you saved it before opened in other browsers?


Yes I made commit and send it to github pages. I can see my files there and when i open css file directly on github whole code is there... The other styling for text and body etc is ok but only background image don't show up...


I final got this... Patch to background image has to be url(.. /img/man-1.jpg) :-) thank for a hint


Glad to help :)


Sometimes browsers cache css and they won't reload a fresh one. If you are using chrome try refreshing a page by CTRL + F5, that shortcut will clear the cache and hopefully solve your problem.