web technology unit 2
web technology unit 2
HTML lists allow web developers to group a set of related items in lists.
It has three types in html are:
1. Unordered list.
2. Ordered list.
3. Description list.
1. Example:
Item
Item
Item
Item
1. First item
2. Second item
3. Third item
4. Fourth item.
Example:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<html>
<body>
<h2>An unordered HTML list</h2>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
Output:
Coffee
Tea
Milk
Example:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<html>
<body>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</Ol>
</body>
</html>
Output:
1. Coffee
2. Tea
3. Milk
Example:
<dl>
<dt>Coffee</dt>
<dt>Milk</dt>
</dl>
A nested HTML list is a combination of ordered list and un ordered list to display the content in
the web page.
An example of nested HTML list is displayed below using un ordered list with Ordered list is
shown below,
<html>
<body>
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
Output:
A Nested List:
Coffee
Tea
o Black tea
o Green tea
Milk
List in HTML helps to display a list of information semantically. There are three types of lists in HTML:
In HTML unordered list, the list items have no specific order or sequence.
An unordered list is also called a Bulleted list, as the items are marked with bullets.
It begins with the <ul> tag and and closes with a </ul> tag.
The list items begin with the <li> tag and end with </li> tag.
Syntax:
<ul>List of Items</ul>
Sample program:
<html>
<head>
</head>
<body>
<h2>List of Fruits</h2>
<ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
<li>Grapes</li>
<li>Orange</li>
</ul>
</body>
</html>
In HTML, all the list items in an ordered list are marked with numbers by default instead of
bullets.
An HTML ordered list starts with the <ol> tag and ends with the </ol> tag.
The list items start with the <li> tag and end with </li> tag.
Instead of numbers, you can mark your list items with the alphabet: A, B, C or a,b,c, or roman
numerals: i, ii, iii, etc.
You can do this by using the <ol> tag type attribute.
Let’s explore how to order lists with alphabets and roman numbers.
To mark the list items with letters A, B, C, etc., you must specify A as the type attribute’s value in
the <ol> tag.
3) Table :
HTML tables allow web developers to arrange data into rows and columns.
A table in HTML consists of table cells inside rows and columns.
Table Cells:
Table Rows:
Each table row starts with a <tr> and ends with a </tr> tag.
tr stands for table row.
SAMPLE PROGRAM:
<html>
<style>
table, th, td
</style>
<body>
<table style="width:100%">
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
</body>
</html>
Table header:
Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead
of the <td> tag:
th stands for table header.
EXAMPLE:
<table>
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
4) Frames :
HTML allows programmers to divide a single browser display into multiple window sections,
where each section can load individual URLs.
This concept of HTML providing multiple frames at one browser display is called frameset, and
all the frame tags are used within the container tag <frameset>.
So the entire separation of HTML pages is possible using the concept of frames.
This tag defines a specific window or frame inside the <frameset> tag.
Every <frame> within the <frameset> tag may use attributes for different purposes like border,
resizing capability, include scrolling, etc.
The primary use of these frames was to display a menu in parts of the page with content in one
part of the page.
Multiple HTML pages can be viewed in a browser window using this tag.
<html>
<head>
</head>
<frameset cols="20%,*">
</frameset>
</html>
src: is implemented for fetching the HTML file that needs to be loaded in one of the frames. It
takes the value as filename.html or filename.htm within double-quotes.
name: facilitates you in giving a name to your frame, and hence you can indicate which frame(s)
you are supposed to load into your page.
frameborder: is used for specifying if the borders are being shown in the frame you are using,
and you can assign values either: 1 (yes) or 0 (no) for it.
marginwidth: facilitates specifying the frame borders width spacing on the left and right sides. It
takes the value in pixels.
marginheight: facilitates specifying the frame borders height spacing on top and bottom sides. It
also takes the value in pixels.