Alisinna Alisinna - 6 months ago 12
CSS Question

Website image not being displayed CSS

I have been doing a website, and i have a problem because the image does not want to be displayed on screen. However, I have checked the code multiple times and it all seems correct! And the image is also located within the same folder of the php file. I really don't know why this is happening. Could you please help me figure it out?
Thank you!

This is the code:

<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Josefin+Slab:400,700' rel='stylesheet' type='text/css'>
<style>
body{
background-color: black;
font-family: 'Josefin Slab', 'Myriad Pro', Arial, sans-serif;
color:white;
font-size:80px;
text-align:center;
}
.container {
width: 1000px;
}
.div1 {
background-image: url("pic1.jpg");
}

</style>
</head>
<body>
<h1>Restaurant</h1>

<div class="container">
<div class="div1">
</div>
</div>
</body>
</html>

Answer

Your Code is correct. The only thing you need to do is adding content to your div, like

<div class="div1"><h2>Here is another caption</h2></div>

In the are of h2 there will be your specified background picture.

RESULT