The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> problem with path of image, beginners html and css
ahnam
post Apr 16 2021, 05:31 AM
Post #1





Group: Members
Posts: 8
Joined: 7-April 21
Member No.: 27,885



Backoud info:

The HTML is in folder C:\Users\anine\Documents\CSS Learn
The images are in folder C:\Users\anine\Documents\CSS Learn\image

The path on the images in the HTML is

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css"
href="style.css">
</head>
<body>
<h2 class="subtitle">About this image 1</h2>
<img src="..\image\logo.png">
<br>
<h2>About this image 2</h2>
<img src="..\image\img_white_flower.jpg">
</body>
</html>

If I put the imges in the HTML path then the images are displayed.

When I put them in the image folder then they are not displayed.
I put the whole path in - images not displayed
I change the \ the / - images not displayed
I made sure that the name of the images are corrects - images not displayed

Can somebody be so kind as to show me what I am doing wrong because I am not stuck?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 16 2021, 06:34 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



1. Use URLs not Windows paths.

2. You've got the relative URL wrong. ../ means one folder up. Correct relative URL would be

CODE
image/logo.png


See further here https://htmlhelp.com/faq/html/basics.html#relative-url .

Full path may not work, depending on what browser you use, but full URL should.

CODE
file:///C:/Users/anine/Documents/CSS%20Learn/image/logo.png



Also, spaces in file and directory names aren't a good idea, because spaces aren't allowed in URLs and must be URL encoded, e.g. replaced with %20 as in my example above. You can use hyphen or underscore as word separators if you still want several distinguishable words in the name. Uppercase can also be tricky, since most servers are case sensitive, unlike windows. It's easy to make a mistake with that if you don't stick to a strict naming scheme. I'd use all lower case. Even if you are just playing on your computer now, I assume you at some point will want to place your stuff on a server, so it's as well to have that in mind from start. Good habits, you know. wink.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
ahnam
post Apr 16 2021, 06:44 AM
Post #3





Group: Members
Posts: 8
Joined: 7-April 21
Member No.: 27,885



Thanks you very much pandy!!!!!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 16 2021, 07:10 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



You are welcome. smile.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th March 2024 - 11:23 PM