First, my apologies for not having a Git-Hub repo. I don’t know how to use Git-Hub (yet); so I’m trying to keep my learning focused on HTML and CSS issues. Later, I’ll jump into javascript but before doing that I’ll learn about Git-Hub.
I am building a web page slowly, element by element using HTML and CSS. I try to avoid any stylng within my HTML by putting all of that into CSS files that I link to in the HTML. All is proceeding well until I try to put a photo (.jpg file) into the page using a DIV tag.
Here’s the DIV code.
<div class="parents-photo">
/*put link to Healy & Pa photo here*/
<img class="src=Images/healy-and-pa-ca-1956.jpg" alt="Healy and Pa in front of 527 ca.1956">
</div>
Here’s the code in the CSS file that styles the DIV
The photo is in the jpg file (healy-and-pa-ca-1956.jpg) which resides in a subfolder called IMAGES which resides in the folder that contains my project. My HTML file also resides within the project folder. I think in understand the rule that says that if the object (the jpg file) and the source (the HTML file) are not in the same folder that the path to the object must include the qualifier pointing to the folder the object is in. That’s why I put the qualifier ‘Images’ in the path to the jpg file . . . because the html is a file one level above the object. If I have his wrong, then the path declaration is the problem. If I’m right about the path declaration, then I cannot explain why the image is not displaying.
Here’s the problem with your code the src attribute is inside of the "" within the code so the HTML is unable to find it due to that, aswell when you show an image inside of a class, you shouldn’t need the code <img class> due to the div being a class. The alt attribute in the code is fine so you did great there, but remember when you do <img src=""> in your code make sure the src attribute is outside of the "" in your code
Edit: Also when you add an image use the code <img src"imageurlhere.png>, always add the .png, .jpg, ect when you add images
<div class="parents-photo">
/*put link to Healy & Pa photo here*/
<img src="Images/healy-and-pa-ca-1956.jpg" alt="Healy and Pa in front of 527 ca.1956">
</div>
Is this syntax correct? I still cannot get the image (the jpg image) to appear on the page.
Here are the paths to the HTML and the image
G:\HUTCHINS CLAN PROJECT\newHTML.html
G:\HUTCHINS CLAN PROJECT\Images\healy-and-pa-ca-1956.jpg
I have checked, rechecked and rechecked spelling over and over again.
@slightlplyz
Are you suggesting that the word “Images” should not be capitalized? The folder name is capitalized, but I thought file and folder names were not case sensitive.
@ahraitch
Figured it out, I’m working on a website, I renamed the images folder to IMAGES both microsoft edge, and vscode had no problem finding the images with the renamed folder, so it isn’t case sensitive, but what Teller was trying to say right click the image, and select the option Open image in new tab and see if it is in the right folder, and chrome actually sees the file.
@ahraitch
So with my website i have the folder named Lumi-World-Website
Inside of that folder I have a new folder named the samething, but the folder inside of the main one holds the HTML, CSS, JS, Audio, and Images in it like this.
I had already tried that. If I go to File Explorer and navigate to “G:\HUTCHINS CLAN PROJECT\Images\healy-and-pa-ca-1956.jpg” then right click and choose Open With Firefox, the image displays. However, if I copy that string (without the double quotations) and paste it into the HTML, the image does not display.