Jump to content

Adding Images


brianhyun

Recommended Posts

Hi! I'm fairly new to HTML, and I have a question concerning adding images...

 

I'm trying to add an image to my code, but when I open my html file on Safari the image is replaced with a box with a question mark inside of it.

 

<figure>

<img src=“Images/otters.png” alt=“Photograph of a sea otter floating in water” />
<br />
<figcaption>Sea otters are the only marine mammal without a layer of blubber.</figcaption>
</figure>
My html file(above) and the image of the otter are in my desktop folder in a folder named "Images."
The image was acquired from google images and saved to my desktop.
Edited by brianhyun
Link to comment
Share on other sites

It looks like you're using curly quotes for your attribute

 

<img src=Images/otters.png alt=Photograph of a sea otter floating in water />

 

Perhaps some browsers are forgiving and interpret them as standard quotation marks, but other browsers consider the quotes to be part of the file name.

Link to comment
Share on other sites

I downloaded TextMate 2.0, changed the quotation marks, and opened my file on Safari; however, the problem with the image is still occurring.

 

I believe it has to do something with specifying the location of my image relative to my html files.

Link to comment
Share on other sites

 

My html file(above) and the image of the otter are in my desktop folder in a folder named "Images."

 

If the html file and the image file are both in the same folder then you shouldn't include the folder in the image path.

Link to comment
Share on other sites

If your html file is in the images folder your code says the image is located here: imagesimagesotters.png because paths are relative from the location of the file containing the path. This can become a problem if a path is moved from an html file into a css file in a different folder. Also, as Foxy says, in Linux/Unix the path is case-sensitive.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...