HTML Tutorial 2
HTML Tutorial 2
To create a hyperlink, you use the a "<a> </a>" tag with the href attribute. The
Hypertext Reference below (in red) is where users will navigate to if they click on the
link "ESPN Home".
The example above is an external link since it links to an external web address that
does not reside on your domain.
e.g. <a href="aboutus.html">About us</a>
The example above is an internal link. The aboutus.html file is located in the same
folder as the document containing the link.
HTML Images
In HTML, images are defined with the <img> tag.
The <img> tag is empty, which means that it contains attributes only, and has no
closing tag.
To display an image on a page, you need to use the src attribute. Src stands for
"source". The value of the src attribute is the URL of the image you want to display.
The URL points to the location where the image is stored. An image named "boat.gif",
located in the "images" directory on "www.bcc.edu.bb" has the URL:
http://www.bcc.edu.bb/images/boat.gif.
The browser displays the image where the <img> tag occurs in the document. If you
put an image tag between two paragraphs, the browser shows the first paragraph, then
the image, and then the second paragraph.
The required alt attribute specifies an alternate text for an image, if the image cannot
be displayed.
The alt attribute provides alternative information for an image if a user for some
reason cannot view it (because of slow connection, an error in the src attribute, or if
the user uses a screen reader).
The height and width attributes are used to specify the height and width of an image.
HTML TABLES
A table is divided into rows (with the <tr> tag), and each row is divided into data cells
(with the <td> tag). td stands for "table data," and holds the content of a data cell. A
<td> tag can contain text, links, images, lists, forms, other tables, etc.
Table Example
<table>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
If you do not specify a border attribute, the table will be displayed without borders.
Sometimes this can be useful, but most of the time, we want the borders to show.
<table border="1">
<table border=1>
<tr>
<th>STUDENT OPTION</th>
<th>FEES</th>
</tr>
<tr>
<td>Full time:</td>
<td>$1000</td>
</tr>
<tr>
<td>Part time:</td>
<td>$2500</td>
</tr>
</table>