kyle
kyle

Reputation: 11

xampp loading image problems

everyone i'm just starting to learn code and having trouble getting images to appear. i'm using xampp. The alt text seem to shows up when I view the code in the browser but no image. im using a windows. here is my code.

<!DOCTYPE html>
<html>
<head> <title> fitness </title>
<link rel="stylesheet" type="text/css" href="C:\xampp\htdocs\static\css\rsstylesheet.css" />
</head>

<body>
<div class="nav">
 <ul>
<li><a href="">Home</a></li>
<li><a href="">Blog</a></li>
<li><a href="">Fitness</a></li>
<li><a href="">About</a></li>
<li><a href="">Contact</a></li>
 </ul>
 </div>

 <img src="‪C:\xampp\htdocs\static\css\background.jpg" alt="background" width="200px" height="200px" />

 <h2> fitness</h2>
 </body>
</html>

Upvotes: 1

Views: 494

Answers (1)

user4621049
user4621049

Reputation:

You should change your src.

At the moment you are referring your whole path, but you only need the part after the location of your file.

So if your file is in the 'htdocs' folder and your image is in the 'static/css/' folder, you can just add 'static/css/' before your image and you are good to go.

You might also consider changing '\' to '/'.

Upvotes: 1

Related Questions