Tag: img

BGE – Images on websites

The <img> tag is used to add an image to a webpage. <img> uses attributes to descibe the image and its location.


<img src="egg.jpg" alt="A picture of a chocolate egg">

  • src – The value of this attribute is the full name of the image file, in this case egg.gif which is in the same directory as the html file.
  • alt – The value of this attribute is a description of the image. This is used in case the image fails to download or it can be read aloud by screen readers.

HTML – Hyperlinks

The H in HTML stands for Hyper,but what does that mean?

Hypertext is text which can link to other files, this is called a hyperlink. A hyperlink is composed of two parts, the anchor and the destination.

<a href=”http://www.google.com”>Google</a>

In the example above the anchor tag <a></a> is used to set an object (text or image) as an anchor, in this case Google. The href attribute is used to identify the destination of the link, in this case http://www.google.com. This is called an external hyperlink as the destination is on another server. If you were linking to a file on the same server then the internal hyperlink would be.

<a href=”page1.html”>Page 1</a>

The anchor tag can be placed around other HTML elements such as images.

<a href=”http://www.google.com><img src=”googleLogo.png”></a>

This would place a border around the image indicating that it is an anchor.

You can specify where to open the linked document using the target attribute.

Value Description
_blank Opens the linked document in a new window or tab
_self Opens the linked document in the same frame as it was clicked (this is default)
_parent Opens the linked document in the parent frame
_top Opens the linked document in the full body of the window

So if you want the Google link above to open in a new tab you would change it to.

<a href=”http://www.google.com” target=”_blank”>Google</a>