Kasper Östberg
Kasper Östberg

Reputation: 41

CSS - Background image doesn't show up

I'm trying to add a background image to my page but it doesn't show up. Could someone help me out please ?

.body{
background-image: url('file:///C:\Users\kaspe\Desktop\Website\backgrund.jpg');}

Upvotes: 1

Views: 63

Answers (2)

Irin
Irin

Reputation: 1276

You dont need to give it a full path. just give the foldername/imagename. I assume website is your folder name where you put your image. Try to put it not instead of your code. Moreover add background-size: cover; to show image with full screen.

body {
    background-image: url('Website/backgrund.jpg');
    background-size: cover;
}

Upvotes: 0

bart
bart

Reputation: 1048

You are referencing the 'body' HTML tag so you don't need the dot '.'.

The dot is used for CSS classes.

Try:

body {
    background-image: url('file:///C:\Users\kaspe\Desktop\Website\backgrund.jpg');
}

Upvotes: 2

Related Questions