3.1 More HTML Elements
In this lesson , we will show you more HTML elements. Some elements have properties or attributes. For example, the header element contains attributes such as id and align that specify the header location and position. Take a look at the following examples:
The align=center attribte will align the heading to the centre position. The HTMLcode is:
<h1 align=center>Welcome to HTML Tutorial</h1>
The img element comprises height and width attributes that define an image’s size and the src attribute that links to the location of the image file. The attribute alt is to show the description of an image if the browser cannot render the image.
<img src=”html.jpg” height=”138″ width=”200″ alt=”HTML banner”>
The following table shows some common elements and some of their attributes:
|<h1 align=position></h1>||Element that aligns the heading to the left, right and the centre|
|<strong></strong>||Element that strongly emphasizes the bold format.|
|<em></em>||Element that gives more emphasis to the italic text.|
|<pre></pre>||Element that preserves the original text.|
|<sub></sub>||Element that formats text as subscript.|
|<sup></sup>||Element that formats text as superscript.|
|<hr>||Element that inserts a horizontal ruler. Closing tag is not required here.|
|<hr width=n%>||Element that sets the width of a horizontal ruler.|
|<hr size=m>||Element that sets the height of a horizontal ruler.|
|<hr nonshade>||Element that creates a ruler without the shadow.|
|<p></p>||Element that defines a paragraph.|
|<p align=position></p>||Element that aligns the paragraph to the left, right or centre.|
Now, copy the following paragraph and paste it into your notepad or any suitable text editor.
Save the file as bean.html.