Advertise here.

Wednesday 15 August 2012

HTML lesson #6 - Other useful stuff


In this lesson we'll learn about a few useful extra things to do in HTML.

Background sound

If you want a sound to play when your page is viewed then you need to use the <bgsound> tag. You also have to say how many times the sound must play with the loop attribute:
<bgsound src="mysound.mp3" loop="3">
You can use a few different types of sound files like MP3 and WAV. If you want the sound to loop forever just set loop="infinite".

Horizontal rules

You can put a horizontal line across your page by using the <hr> tag. You can change its color with the color attribute and you can change its thickness with the size attribute:
<hr color="red" size="5">
You are also able to change its width and height:
<hr width="300" height="100">
You can use pixels or % for width and height.

Special characters

If you put 3 spaces between the letter a and b in your html file you'll see that you still only get one space. If you want to put in more than one space you have to use a special character which is &nbsp;. To put 3 spaces between the letters a and b you would do the following:
a &nbsp;&nbsp;&nbsp; b
If you wanted to show an example of a tag on your page you would be able to use < and > because they would be seen as an html tag. You have to use &lt; for < and &gt; for >. The following example will give you the opening and closing BODY tags:
&lt;body&gt;
&lt;/body&gt;



There are a lot of other special characters but those are the most commonly used.

Attributes : Ankit Fadia, Mohammed E. Katz, Wadria William. learnprogramming.co.za