Hi, just starting out. I'm trying to put your basic image in the html code with the "<img src=" tag. I was on a tutorial and they say that in this you basically tell the browser what the url of the image is. Yet in their example it wasn't a url but, it seems, just the file that was listed, like, well here's the actual example in the tutorial: <img src="w3schools.jpg" width="104" height="142" /> - how's that a url? Don't you need the: http://www. etc? Probably some simple answer but I can't seem to find it at the moment. thanks a lot, Will MacBride also I was wondering: does it have to come from a web address? i.e. if I have a picture on a hard drive I want to put on a website I'm designing, woulc I have to upload that to some website (i.e. photobucket or something) and then reference it? Or could I reference it somehow just from my hard drive somehow?
If u use only the file name then it will work as long as the file is in the directory where your HTML file is. For ex. If your images are stored in images folder and your url to image is : http://www.yourdomain.com/images/abc.jpg then you can use either the full url or just images/abc.jpg Both will work.
More info: when you just use the file name it's called a relative path meaning it's relative to the location of the page being accessed. If you give the full URI, then that's called absolute pathname.
Yeah. image.jpg are just images that you have uploaded on your server. You could put the entire URL and it would work the same. You do need the entire URL for images that are not in your directory.
Thanks for those there clraificationalities folks... The thing is, right now I'm writing a page in notebook - it's not uploaded to any server yet. I tried just putting the file name and it didn't work. Come to think of it maybe it wasn't in the same directory i.e. I didn't put the full path. That should work if I'm just writing the page in notebook right? thanks a lot, Will
Like people said you have to follow the certain path to the image. Easiest way, and the common way is to put all images in images folder. For example you've made new folder called "My Website" in My Documents, now you store all your .html files in that folder (My Website folder). If you store any images in that folder then you can just write the filename <img src="image.jpg" /> But if you create another folder inside the My Website folder named "images" for example and put images on it you have to specify the path. Same goes when you put your files on some server. So in that case the img code would look like: <img src="images/image.jpg" /> As you see you don't need to specify the whole path because the folder where you store your index.html file (in this case My Website folder) is considered as root folder.