0

New to HTML coding

I have a folder containing a) my HTML file for my homepage b) a folder called images

In my image tag if I copy and paste the whole url from my c drive C:..... then the image works.

I want to use a shorted URL I have tried src="\images(imagename).gif"

but it wont work, I was sure this was the the right URL as its a folder in the same folder as my html document...

Any help is much appreciated

Charlie74
  • 2,883
  • 15
  • 23
  • The web fortunately does not rely on Windows and it's horrible backslash exclusively. Get used to `/`, don't ever start a file or folder with a capital letter again and remove your spacebar completely. – Deryck Jan 11 '14 at 18:50
  • Anything I can do to improve quality of life for us all :) – Deryck Jan 11 '14 at 19:52

1 Answers1

2

As you mentioned, your images folder is in the same location as your HTML. So, you should be able to access the images like:

src="images/myimage1.gif"

Based on your comment below, your code looks as if there are a couple of typos. This line:

<img src="images/cartmanbane.gif"" alt="cartman" height="285" width="497>

Should be this (you have quotes where they don't belong):

<img src="images/cartmanbane.gif" alt="cartman" height="285" width="497">

You should notice here on the site that the highlighting is different between those two lines as well.

Charlie74
  • 2,883
  • 15
  • 23
  • This works perfectly if the folder structure is as you described. Maybe you can add your code to the question? Or take a screenshot of your folder / file setup? Then we can see exactly what trouble you are having. – Charlie74 Jan 11 '14 at 20:17
  • Ive tried putting everything lower case and it still wont work :/ – user3185724 Jan 11 '14 at 20:18
  • Ill copy it in here now – user3185724 Jan 11 '14 at 20:26
  • Take a look at the edited answer... if that STILL doesn't work, open your page in the browser, press F12 to open your developer console, and check for errors that show up when reloading the page. – Charlie74 Jan 11 '14 at 20:33
  • Still wont work :@ ill try the developer console, how do I know if there's an error? – user3185724 Jan 11 '14 at 21:05
  • Failed to load resource: the server responded with a status of 404 (Not Found) http://www.google.com/images/cartmanbane.gif – user3185724 Jan 11 '14 at 21:10
  • is this to do with setting the base ? – user3185724 Jan 11 '14 at 21:11
  • Well, I can see your image is pointing to Google as a hosting server. Not sure how you're getting that from your code above. There's something else going on here. You are testing this webpage from your local machine right? You could always try using `cartman`, which means the images folder is off your website's root folder, and see if you get different results. But I can't see why your img source would be pointing to Google. – Charlie74 Jan 11 '14 at 23:03
  • Sorted, Thanks for your help. The Base tag in my head secion was set to google and not my homepage... – user3185724 Jan 12 '14 at 21:27