X hits on this document

PDF document

HTML Beginner's Guide - page 9 / 16





9 / 16


The a tag allows you to open the link in a newly spawned window, rather than replacing the web page the user is on, which at first thought may sound like a good idea as it doesn't take the user away from your site.

There are a number of reasons why you shouldn't do this however.

From a usability point of view, this method breaks navigation. The most commonly used navigation tool on a browser is the 'back' button. Opening a new window disables this function.

On a wider, more general usability point, users do not want new windows to be popping up all over the place. If they want to open a link in a new window then they can choose to do so themselves.


Things might seem a little bland and boring with all of this text formatting. Of course, the web is not just about text, it is multi-media and the most common form of media is the image.

The img tag is used to put an image in an HTML document and it looks like

this: <img src="http://www.htmldog.com/images/logo.gif" width="157" height="70" alt="HTML Dog logo" />

The src attribute tells the browser where to find the image. Like the a tag, this can be absolute, as the above example demonstrates, but is usually relative. For example, if you create your own image and save it as

'alienpie.jpg' in a directory called 'images' then the code would be <img src="images/alienpie.jpg"...

The width and height attributes are necessary because if they are excluded, the browser will tend to calculate the size as the image loads, instead of when the page loads, which means that the layout of the document may jump around while the page is loading.

The alt attribute is the alternative description. This is used for people who cannot or choose not to view images. This is a requirement in the latest versions of HTML.

Note that, like the br tag, because the img tag does not have a closing tag, it closes itself, ending with '/>'

Document info
Document views53
Page views53
Page last viewedThu Jan 19 13:38:43 UTC 2017