HTML - Part Iii
HTML - Part Iii
HTML - Part Iii
1
HTML Tables
Introduction
2
Good Bad
Cute Ugly
• <TABLE> …… </TABLE>
¾Defines the beginning and the end of a
table.
¾Can have several attributes:
bgcolor = #rrggbb or color name
rules = all | cols | rows | none
border = number
height = number, percentage
3
• <TR> …….. </TR>
¾Defines a row of cells within a table.
¾Can have several attributes:
bgcolor = #rrggbb or color name
align = left | center | right | justify
• <CAPTION> …….. </CAPTION>
¾Provides a caption for the table.
¾Must immediately follow the “table” tag,
and precede all other tags.
4
• <TH> …….. </TH>
¾Defines a table header cell.
¾Browsers generally display the contents
of the header cells in bold, and
centered.
¾Same attributes as the <TD> tag.
Table Example 1
<table>
<tr> <td colspan=2> Hello </td> </tr>
<tr> <td> Good </td> <td> Day </td> </tr>
</table>
Hello
Good Day
5
Table Example 2
<table>
<tr> <td rowspan=2> Hello </td>
<td> Good </td> </tr>
<tr> <td> Day </td> </tr>
</table>
Good
Hello
Day
Table Example 3
<table border=1>
<caption> My Table </caption>
<tr> <th> Name </th> <th> Marks </th> </tr>
<tr> <td> Anil </td> <td> 72 </td> </tr>
<tr> <td> Kamal </td> <td> 58 </td> </tr>
</table>
Name Marks
Anil 72
Kamal 58
6
HTML Frames
Introduction
7
A Web Page that use Frames
• Merits:
¾Allow parts of the page to remain
stationary while other parts scroll.
¾They can unify resources that reside on
separate web servers.
¾There is a <noframe> tag, using which it
is possible to add alternative content
for browsers that do not support
frames.
8
• Demerits:
¾All browsers do not support frames.
¾Documents nested in a frame is more
difficult to bookmark.
¾Load on the server can be significantly
increased, if there are a large number of
frames in the page.
¾Frames are very difficult to handle for
search engines.
9
• <FRAME>
¾Defines a single frame within a
frameset.
¾Attributes:
frameborder = 1 | 0
src = url
scrolling = yes | no | auto
marginwidth = number
marginheight = number
name = text
• <NOFRAMES> …… </NOFRAMES>
¾Specifies the contents to be displayed
by browsers that cannot display frames.
¾Ignored by browsers that support
frames.
10
Frame Example 1
<html>
<head><title> A document with frames
</title> </head>
<frameset cols = “*,*”>
<frame src = “left.htm”>
<frame src = “right.htm”>
</frameset>
<noframes>
Browser does not support frames.
</noframes>
</html>
Frame Example 2
<html>
<head><title> Another one with frames
</title> </head>
<frameset cols = “100,2*,*”>
<frame src = “left.htm”>
<frame src = “right.htm”>
</frameset>
<noframes>
Browser does not support frames.
</noframes>
</html>
11
Frame Example 3
<html>
<head> <title> Nested frames </title> </head>
<frameset cols = “25%, *”
<frame src = “one.htm”>
<frameset rows = “100,150,100”>
<frame src = “two.htm”>
<frame src = “three.htm”>
<frameset cols = “*,*”>
<frame src = “four.htm”>
<frame src = “five.htm”>
</frameset> </frameset> </frameset>
</html>
M
E
N
U
12
¾Assign a name to the targeted frame.
<frame src = “somepage.htm” name = “abc”>
13
Introduction
• Some examples:
H2 {color: blue}
P {font-size: 12pt;
font-family: Verdana, sans-serif;
}
14
Inline Styles
<html><head>
<style type = “text/css”>
<! - -
H2 {color: blue}
P {font-size: 12pt;
font-family: Verdana, sans-serif;
}
-->
</style>
15
<title> Example of using style sheets </title>
</head>
…….
…….
</html>
<head>
<link rel = “STYLESHEET”
href = “/pathname/mystyle.css”
type = “text/css”>
</head>
16
There is more ….
17
SOLUTIONS TO QUIZ
QUESTIONS ON
LECTURE 14
18
Quiz Solutions on Lecture 14
19
Quiz Solutions on Lecture 14
20
QUIZ QUESTIONS ON
LECTURE 15
21
Quiz Questions on Lecture 15
22