Beginning HTML


The image tag is another of the small family of HTML tags that do not have an end tag. The image tag must be passed a parameter to tell the browser where to load the file from. This parameter is the src (or source) parameter. Some code for loading the image, me.jpg is shown below:
<img src="me.jpg">

We can also uses images as links. If we wanted to use the above image as a link to the aboutme.htm page, then we could use this code:

<a href="aboutme.htm"><img src="me.jpg"></a>

Try experimenting with this concept. You'll understand it much better once you have a go yourself!

The image tag can also accept width and height parameters. These are measured in pixels. If you set only one of these parameters, the other dimension is altered to keep the image to scale. If you set both then you can resize the image to be out of proportion if you wish. The following code would set our image to height 50 pixels and width 100 pixels:

<img src="me.jpg" width=50 height=100>

The body tag has another parameter that can be used to alter the background picture. The browser will tile the image if it is too small. If I wanted to set the background of my index.htm page to the me.jpg image then I'd use this code:

<body background="me.jpg">

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“You can stand on the shoulders of giants OR a big enough pile of dwarfs, works either way.”