Jump to content

Very basic HTML question

Recommended Posts

Hello, I'm brand new to HTML

 

I'd be so grateful if somebody could help me out with this:

 

I'd like to include a picture on a webpage. if i save the picture as say cat.gif then should <img src="cat.gif" /> display the image?

 

or do i need to include where the image is saved?

 

and do i need the / at the end?

 

so grateful for help

Share this post


Link to post
Share on other sites

if the image file is in the same diractory as that HTML page then it should work

Share this post


Link to post
Share on other sites

If you're using XHTML, you'll need the / to "self close" the tag - like using

<br />

instead of

<br>

.

 

All tags in XHTML have to be opened and then closed in order to be valid code.

 

http://www.w3schools.com should be your next port of call.

Share this post


Link to post
Share on other sites

Most people put their images in a folder called images, but you don't have to. It's just for convenience, so that all the images are in one place.

 

You could do it as you said. In Windows Explorer (if you're using it) you'd see pagewhatever.html, pagewhateversomethingelse.html, cat.gif and it would work.

 

If you put your cat.gif in a folder called images then the link would be <img src="images/cat.gif" />

Share this post


Link to post
Share on other sites
If you're using XHTML, you'll need the / to "self close" the tag - like using
<br />

instead of

<br>

.

 

Or indeed ...

 

<img src="cat.gif" />

As you originally did ;):thumbsup:

Share this post


Link to post
Share on other sites

thanks for this excellent help guys.

 

so if my image is saved in the same folder as the webpage is the destination would just be cat.gif and if i have an images folder in the folder that the webpage is the destination would be /images/cat.gif ?

Share this post


Link to post
Share on other sites

the reference would be <img src="images/cat.gif" />

Share this post


Link to post
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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.