satbeachgrl satbeachgrl - 6 months ago 22
CSS Question

Background image doesn't show up

I have tried following tutorials on W3schools, and I've also dug into Developer Tools on the website I'm tasked with cloning, and have gone back to my previous project when I had to do a

background image
.

I know this is a user error, but I am stuck.

My HTML looks like this:

<section class="introduction"> <img src="background-image">


and my CSS looks like this:

.introduction {
background-image: url('../images/karma-background.jpg');
}

Answer

You don't require an image object

<img src="...">

css and background images work like so.

<section class="introduction"></section>

.introduction {
background-image:url('../images/karma-background.jpg'); 
}

so actually the problem is you haven't ended your section tag like I have in my example. You may have to add additional css for sizing