The HTML image tag: img for adding images to your web sites.
Now that you’ve mastered the paragraph HTML tag p and line break HTML tag br, let’s learn how to add an image to our web page.
The image tag: < img/ > is another self-closing tag. Inside the tag itself, you have to include a piece of information called the source (src) attribute. An image tag looks like this:
<img src="image.jpg"/>
The equals sign = and double quotes ” ” set the value of the source attribute.
An ATTRIBUTE is a useful way of giving your browser extra information about a HTML element.
There are lots of different kinds of attributes you can include in your tags. There are two parts to an attribute: the attribute name and the value of the attribute.
You use an equals sign = to set the value of the attribute and put the value in double quotes ” “
So an attribute will always look like this: name=”value”
Attributes are added to the opening tag, or to the only tag (in the case of a self-closing tag).
You have to include the source attribute in the
<img/>
tag so your browser knows where to find your image.
Without it, your browser won’t know what to display on-screen.
The value of your source attribute can either be set to a file name of a saved image or a URL (web address) of your image.