I am facing an issue where the background url()
property only seems to work with online stored images. Local stored images do not display when I try to use them.
This is my folder structure:
- index.html
- src
- css
- style.css
- images
- background.png
- profilepicture.png
- css
Here is the HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./src/css/style.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<title>Document</title>
</head>
<body>
<div class="profile-card">
<div class="card-header">
<div class="pic">
<img src="./src/images/profilepicture.png" alt="">
</div>
<div class="name">###</div>
<div class="desc">Front-End Developer</div>
<div class="sm">
<a href="#" class="fa fa-instagram"></a>
<a href="#" class="fa fa-twitter"></a>
<a href="#" class="fa fa-github"></a>
<a href="#" class="fa fa-linkedin"></a>
</div>
<a href="#" class="contact-btn">Contact Me</a>
</div>
<div class="card-footer">
<div class="numbers">
<div class="item">
<span>120</span>
Posts
</div>
<div class="item">
<span>127</span>
Following
</div>
<div class="item">
<span>120k</span>
Followers
</div>
</div>
</div>
</div>
</body>
</html>
And here is the CSS code:
* {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
box-sizing: border-box;
text-decoration: none;
}
body {
height: 100vh;
background: url(./src/images/background.png) no-repeat center;
background-size: cover;
}