Background img | SoloLearn: Learn to code for FREE!

+1

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

+1

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

+3

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.

+1

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

+1

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

+1

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

+1

Glad to help :)

0

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.