Christian Diaz
Christian Diaz

Reputation: 5

Why isn't my image displaying on my webpage?

Hello I'm a beginner at web construction and html and was wondering if someone can help me out.. my image won't display on my webpage. The picture file resides in the images directory which is in the same folder as the index.html file.

This is the part of the code from the index.html file

<body>
<h1> Minimalism  </h1>
<img src="../images/pd.jpg" alt="Partisal disinvestment">

</body>

yet the image won't display? is the path right? I also even set permissions like chmod 755 on the image file but nothing..please help thanks

Upvotes: 0

Views: 3949

Answers (3)

Ben
Ben

Reputation: 3528

check the case-sensitivity of the filename.
e.g pd.jpg vs pd.JPG

Upvotes: 0

martineno
martineno

Reputation: 2635

Remember that ../images/pd.jpg will be relative to the path where index.html is being served from.

In other words, if index.html is being served out of /a/long/path/index.html, your reference of ../images/pd.jpg would mean the file pd.jpg would have to be stored in /a/long/images/pd.jpg, for the image to load.

Upvotes: 1

miu
miu

Reputation: 1304

<img src="images/pd.jpg" alt="Partisal disinvestment">

../ means one directory up, but your images folder in the same directory as index.html. So you can do src="./images/pd.jpg" (one . stands for the current directory) or you can leave it.

Upvotes: 3

Related Questions