skunkbear
Images- the img tag

Once you have a webpage with text and fancy background colors, you probably want to add an image or two. To add an image you use the <img> tag. It does not have a closing tag. It looks something like this:


The img tag has too parts that you need to set. You put the image file name inside quotes in src="". Src is short for source, but I always think of it as search, like search for the image that equals "zombie.jpg". If the image is not in the same folder as your webpage, don't forget the full path to the image. If zombie.jpg was in a folder called "images", and that folder was in the same folder as my webpage, then I would write src="images/zombie.jpg".

Another thing you have to set is alternate text for your image in case it can't be displayed. It should describe what the image looks like, or if text is on the image you should probably write that in the alt text. Just put a description in between the quotes in alt="".

You can also specify a height and/or width like this:


submit to reddit

More: HTMLimgsrcaltimages

Source: Seth | 2012-05-15

Recent Posts:

Repeating background image

Don't forget to comment your work

Layout your webpage using divs

Link it together

Images- the img tag