Tayfun İlbakan
Tayfun İlbakan

Reputation: 15

My Background Image Doesn't Show Up On Github

I have a sample landing page which I uploaded to gitHub. When I preview it on my computer with local files, everything works fine but I cannot see background image when I upload it to gitHub.

I've tried below codes to make it work but couldn't. You can check gitHub respiratory from here if you wish. And page from here.

background-image: url(images\main.jpg);
background-image: url(/images/main.jpg);
background-image: url(../images/main.jpg);

background-image: url(images\main.jpg);
background-image: url(\images\main.jpg);
background-image: url(..\images\main.jpg);

Upvotes: 0

Views: 72

Answers (1)

BelKed
BelKed

Reputation: 97

In index.html are you loading style using:

<link rel="stylesheet" href="css\styles.css">

But it should be:

<link rel="stylesheet" href="css/styles.css">

Also, in styles.css you should load image using

background-image: url(../images/main.jpg);

GitHub sites runs on Linux machines, that use in pathnames / instead \ and Macs also uses /.

Upvotes: 1

Related Questions