Every time i try writing the code to put in an image and i veiw the page it appears as a little swuare with the red x in it. What is the exact code for images. and i write everything in notepad.
Announcement
Collapse
No announcement yet.
HTML code for putting in images
Collapse
X
-
a missingalt
attribute in an <img /> won't stop the image from displaying as long as the path to the images in the src is correct.
The alt attribute is meant to just display "alternate text" if an image in the src is not found and for screen readers to read for their users. Some browsers also display the alt text when you hover over an image, but the title attribute is best used for that.
Comment
-
-
i put <img src='C:\Users\Reb\My Pictures\Downloads\anonymous.jpg' />
And it still did the red x but im also diplaing the html file in IE is that what is causing it or is it i wrote the path wrong. Cause i cant find where it says the full path of the image in my computer. ( i have windows 7)
Comment
-
-
Ok i see but i still dont know where to find the path to the image. im looking at in in my pics but i cant find where it displays the path. it displays half of it in the properties of the photo but not the second half. Total noobie status
'
Comment
-
-
ok, do the following and it should work. It's usually better to use relative rather than absolute paths
1 - put your html file inC:\Users\Reb\My Pictures\Downloads
where your image currently is. Let's call the html filemyFile.html
if you like.
2 - then inmyFile.html
in the <body> add
Code:<img src="anonymous.jpg" alt=" my anonymous photo" />
Last edited by webdev1958; Aug 28, 2011, 05:22 AM.
-
👍 1
Comment
-
-
pheeww - glad it's sorted
Now when you write the path is it supposed to be the file location or the path from the html file to the img you want to post?
Normally I specify relative path names, so my suggestion to make things easier for you, is to create a "work area" folder somewhere on your C: drive and put your html files in that folder. Under that work area folder create a sub folder called pics and put all your images in there for the current exercise.
Then in your html files when you need to display an image just do this
Code:<img src="./pics/myPic.jpg" alt="" />
Last edited by webdev1958; Aug 28, 2011, 05:36 AM.
Comment
-
-
Thats a good idea. Now i was making a website and the code for it isnt a file is a file i saved in my computer put i jsut copy pasted it into a section for html code in the website editor. So if i want to put an img on there would i be writing the same path?
Comment
-
Comment