banner
Welcome to HTML.co.uk, the number one resource for all news, information, and happenings regarding HTML.

Updates: HTML.co.uk has just been relaunched. Subscribe to our RSS Feed to stay on top of HTML news and techniques.
May
29th

Working with Images in HTML

Author: Editor | Files under HTML Basics, HTML Tutorials
Tags for this article: , , , , ,

A single image speaks more clearly than a thousand words. Images add spice to the web page. They make a website interactive and user friendly. In fact, images are the most vital element of a web page, especially those designed for children. In the absence of images nobody will enjoy web surfing. Today almost every web page contains images in order to increase its worth. So, it would be useful to have a look at the different aspects of an Image in HTML.

HTML basically supports two types of images i.e. .Gif and .Jpg image. While .Jpg images are static, the .Gif images can be both static and dynamic. tag is used to put an image on a web page. This tag has lots of attributes which are used to align an image, define its size and position etc. To add an image there are some basic attributes which should be used.

1) <IMG> tag is necessary
2) Then SRC attribute must be there to tell the document the source from where it will get the image.

For example:

<HTML>
<IMG SRC=”d:\images\hello.jpg”>
</HTML>

In the above example the <HTML> and </HTML> tags represent that this document is a web page. The IMG tag is representing the addition of an image in the web page. The SRC is the attribute of IMG which tells that from where and which image is to be inserted .There is no need to close the <IMG> tag with </IMG>.

One thing which should be noted is that you can give the full path to an image as well as only name of the image with the SRC attribute. If you are using an image which is not in the same folder where your HTML document resides, then you have to give its full path like d:\images\hello.jpg. In contrast if the hello.jpg file is in the folder where your HTML document and files are saved then you can mention only its name as like <IMG SRC=”hello.jpg”>. Another point which should be remembered is that you have to mention the full image name including its extension like hello.gif or hello.jpg otherwise the image will not be displayed. You can adjust the aliment, height, width and border of the image. If you set the value of border=0 then the border will disappear. In contrast, you can start increasing the value of height, width and border as per your requirements.

For example:

<IMG SRC=”d:\images\hello.jpg” ALT=”Hello” HEIGHT=”200” WIDTH=”600” BORDER=”6” >

Below are the different attributes and their explanations which can be used with <IMG>

  1. ALIGN: It is used to set the alignment of the image. You can use it as ALIGN= TOP, ALIGN= MIDDLE, ALIGN=CENTER, ALIGN= LEFT and ALIGN= RIGHT.
  2. BORDER: It is used to set the size of the border of the image.
  3. WIDTH: It is used to set the width of the image
  4. HEIGHT: Used to set the height of the image
  5. HSPACE: Represents the amount of space to the right and left of the image.
  6. VSPACE: Represents the amount of space to the top and bottom of the image.
  7. ALT: It represents the text which is to be displayed in place of image in case the web browser is unable to display the image.

May
23rd

HTML: Adding Sounds to Web Page

Author: Editor | Files under HTML Tutorials
Tags for this article: , , , , ,

You can make the web page interesting with Graphics and texts and construct an interesting web page. Then the question is, what makes the difference between any two web pages, when the input for page construction-Graphics and Text-are the same. In other words, what is the basis of considering whether a particular page is good or bad?

Surprisingly, it is the same resource-Graphics and Text-that make the difference. For example, images are used to give a different look to the overall design of the page. But the visibility or clarity of the image makes the difference. To give a classy look, the image must be clear. Once that is done, you need to put in good pieces of information because it is the quality of content that pulls visitors.

There is another way to make the web page interesting. All you have to do is ton add some music and sound to it.. These days a lot many websites are doing this to attract people to browse them. It is wonderful for when you open the site, the musical sound automatically turns on and when you navigate, it runs off. This is called adding different sounds to different pages. This is not difficult at all to add sound to your page using html programming. The following 2 options are there and they both are simple and easy.

1. Link a sound file in your computer to the web page. The people visiting the web page will download this file and then it will play
2. Embed the sound you want to play into the page itself.

We will go through both the options to see their functionality with HTML. Sounds cool, well let us go ahead to analyze the first option of linking the sound file to the web page. Now you will have a practical go at your tags. Remember the tag HREF which is used for the link. Well here we will use the same tag to link the sound. The command will look something like this.

<a href=”http://www.pageresource.com/sounds/mattdum.mid”>A Cool MIDI Song</a>

When a person clicks on this link he will be given an option to download by the browser and he can get the sound onto his computer. This is quite simple to use. So now even you can add sound to your web page. Well here MIDI type file is used. But if your sound file is of .wav, .aud or some other extension type then you can use that and create the link. Now let us see the scene when you download the song. You will be allowed to play in the player, which uses the particular extension. Once the player is run online, you have the tools present on it to start or pause the sound. This way all the controls for the sound are present with you along with the sound itself.

Next, let us see the other method of adding sound to the web page i.e. embed method. Well in the embed method you need not produce a link. You just need to embed it to the page that is the sound will play as soon as you open the page and it can be repeated all over again if you wish to. This is another cool and better way of adding sound. Here you need to specify the source of the file and other commands.

The command used for embedding the sound into your web page.

<embed src=”http://www.pageresource.com/sounds/mattdum.mid”></embed>