Personal Productivity With Is Technologies IS 21213: Practical
Personal Productivity With Is Technologies IS 21213: Practical
With Is Technologies
IS 21213
Practical
Outline
• HTML
• Form Validation
• Formatting Documents
Web server : a system on the internet containing one or more web site
Web site : a collection of one or more web pages
Web pages : single disk file with a single file name
Home pages : first page in website
• The first tag in a pair is the start tag, the second tag is the end tag (The first tag turns
the action on, and the second turns it off.)
• Start and end tags are also called opening tags and closing tags
05/04/2020 Department of CIS 9
HTML Elements
• An element in HTML is a loose term that describes each individual
piece of your web page
• An element consists of three basic parts: an opening tag, the element's
content, and finally, a closing tag
• <p> - opening paragraph tag
• Element Content - paragraph words
• </p> - closing tag
• Every (web)page requires four critical elements: the html, head, title,
and body elements
• Its sole purpose is to encapsulate all the HTML code and describe the
HTML document to the web browser
• <html> </html>
11
The <head> Element
• The head functions "behind the scenes"
• Place the <title> tag within the <head> element to title your page
• The words you write between the opening and closing <title></title>
tags will be displayed at the top of a viewer's browser
• Name your webpage as you please, just keep in mind, the best titles
are brief and descriptive
13
Cont..
• <html>
<head>
<title>My WebPage!</title>
</head>
</html>
14
The <body> Element
• <html>
<head>
<title>My WebPage!</title>
</head>
<body>
Hello World! All my content goes here!
</body>
</html>
15
Change Sizes-HTML Headings
• HTML Headings are defined with the <h1> to <h6> tags
<html>
<head>
<title>
My First HTML
</title>
</head>
<body>
<h1>This is heading one <h1>
<h3>This is heading one <h3>
<h6>This is heading one <h6>
</body>
</html> 16
HTML Paragraphs
• HTML Paragraphs are defined with the <p> tag
• Eg:
<!-- This is a comment -->
<p>This is a paragraph.</p>
19
Cont..
• 1 <sup> st </sup>
• H <sub> 2 </sub>
20
HTML Attributes
• Attributes are used to describe tags
22
Examples
23
Cont..
• Although you may specify the font style you would like
your text to be displayed, please keep in mind, if your
visitor doesn't have the font face you specify on their
computer, the text will be displayed in the users default
font setting
27
Monospaced text
• Eg:
<TT>This is teletype text</TT>
28
Lists
• There are 2 types in lists. They are :
Unordered List
Provides lists with symbols or bullets.
Ordered List
Provides lists with numeric values.
34
Example
<table>
<tr>
<td>
This is my table!
</td>
</tr>
</table>
35
Cont..
<body>
Hi!
<table border="2">
<tr>
<td>
This is my table!
</td>
</tr>
</table>
</body>
36
Example
<body>
Hi!
<table border="2">
<tr>
<td>This is cell 1</td>
<td>This is cell 2</td>
</tr>
</table>
</body>
37
Cont..
td
<body>
row 1, cell 1 row 1, cell 2
Hi! tr
row 2, cell 1 row 2, cell 2
<table border=“9">
<tr>
<td>row 1, cell 1</td> A table is divided into rows (with the
<td>row 1, cell 2</td> <tr> tag)
</tr>
<tr> Each row is divided into data cells (with
<td>row 2, cell 1</td>
the <td> tag). td stands for "table data,"
and holds the content of a data cell
<td>row 2, cell 2</td>
</tr> A <td> tag can contain text, links,
</table> images, lists, forms, other tables, etc.
38
</body>
HTML Table Headers
• Header information in a table are defined with the <th> tag
• All major browsers display the text in the <th> element as bold
and centered
• <table border="1">
<tr> Header 1 Header 2
<th>Header 1</th> row 1, cell 1 row 1, cell 2
<th>Header 2</th> row 2, cell 1 row 2, cell 2
</tr>
<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> 39
Exercise
Fruit Percentage
Bananas 23%
Oranges 13%
Other 10%
40
Cell Padding and Spacing
<tr>
<td><b>Column 1</b> </td>
<td><b>Column 2</b> </td>
</tr>
<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> 43
Table width & height
44
Cont..
45
align
• align=“left”
Aligns cell contents to the left
• align=“center”
Aligns cell contents to the center
• align=“right”
Aligns cell contents to the right
46
Cont..
<table width=“450” border=“2” cellspacing=“7” cellpadding=“7”>
<tr>
<td align="center">
I’m in the center !
</td>
<td align="right">
I’m aligned to the right!
</td>
</tr>
</table>
47
valign
• Valign=“top”
Align contents to the top of the cell
• Valign=“middle”
Align contents halfway between the top and bottom
of the cell
• Valign=“bottom”
Align contents to the bottom of the cell
48
Cont..
<table width=“550” border=“2” cellspacing=“7” cellpadding=“0”>
<tr>
<td align="center" valign="top">
I’m on top! <br/>
so,I start on top!
</td>
<td align="center" valign="middle">
I’m in the middle!
</td>
<td align="center" valign="bottom">
I start at the bottom!
</td>
</tr>
</table>
49
bgcolor
50
Cont..
<table width="75" border=“2”>
<tr>
<td bgcolor="red">
Red
</td>
<td bgcolor="blue">
blue
</td>
</tr>
51
</table>
Cont..
<table width="200" border=“2”>
<tr bgcolor="red">
<td>Red</td>
<td>Red Again...</td>
</tr>
<tr bgcolor="blue">
<td>Blue</td>
<td>Blue Again... Again...</td>
</tr>
</table> 52
Exercise 1
e1
<th scope=”col”>Introduction year</th>
</tr>
</thead>
Answer
<tbody>
<tr>
<th scope="row">Beacon</th>
<td>Early</td>
<td>1936</td>
</tr>
<tr>
<th scope="row">Haralson</th>
<td>Late</td>
<td>1922</td>
</tr>
<tr>
<th scope="row">Sweet Sixteen</th>
<td>Mid</td>
<td>1977</td>
</tr>
</tbody>
</table>
05/04/2020 Department of CIS 54
Rowspan = “ ”
55
Example 01
<table border="2">
<tr>
<td align="center">
Nice guy,Idn' he?
</td>
<tr>
<td align="center">
Met him at the shop
</td>
</tr>
56
</table>
Example 02
<table border="1" >
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
<tr>
<td rowspan="2">d</td>
<td>e</td>
<td>f</td>
</tr>
<tr>
<td>g</td>
<td>h</td>
</tr>
57
</table>
Exercise
<table border="1" >
<tr>
<td rowspan ="3">m</td>
<td>h</td>
<td>y</td>
</tr>
<tr>
<td>p</td>
<td rowspan="2">e</td>
</tr>
<td>r</td>
</tr>
</table> 58
Colspan = “ ”
59
Example 01
<tr>
<td colspan="3" align="center"><b>Table header</b>
</tr>
<tr>
<td align="center">Table cell 1</td>
<td align="center">Table cell 2</td>
<td align="center">Table cell 3</td>
</tr>
</table>
60
Example 02
<table border="1">
<tr>
<td colspan="3">s</td>
</tr>
<tr>
<td>s</td>
<td>s</td>
<td>s</td>
</tr>
<tr>
<td colspan="2">s</td>
<td>s</td>
</tr>
61
</table>
Exercise <table border="1" width="100">
<tr>
<td colspan="2">a</td>
<td>b</td>
<td>c</td>
</tr>
<tr>
<td>d</td>
<td>e</td>
<td rowspan="2">f</td>
<td rowspan="3">g</td>
</tr>
<tr>
<td>h</td>
<td>i</td>
</tr>
<tr><td colspan="2">j</td>
<td>k</td>
62
</tr></table>
<tr title=“ ”>
<table border="1">
<tr title="You are looking at Row 1” bgcolor="silver">
<td>Row 1 Cell 1</td>
<td>Row 1 Cell 2</td>
</tr>
<tr title="You are looking at Row 2" bgcolor="aqua">
<td>Row 2 Cell 1</td>
<td>Row 2 Cell 2</td>
</tr>
</table>
Row 1 Cell 1 Row 1 Cell 2
64
Exercise
2
1. Use border
=1
2. Use caption
as in the
picture
and
3.Add
summary to
this table
4. Use
different
colour for
each text and
cell
05/04/2020 Department of CIS 65
<!DOCTYPE html>
Ex 2 <html>
Answer
<head>
<style>
</style>
</head>
<body>
<h2>HTML Table</h2>
<TABLE border="1" summary="This is the summary of the table">
<CAPTION><EM>A test table with merged cells</EM></CAPTION>
<TR><TH rowspan="2"><TH colspan="2">Average
<TH rowspan="2">Red<BR>eyes
<TR><TH>height<TH>weight
<TR><TH>Males<TD>1.9<TD>0.003<TD>40%
<TR><TH>Females<TD>1.7<TD>0.002<TD>43%
</TABLE>
</body>
05/04/2020 Department of CIS 66
</html>
Forms
• Action gives the URL of the program which will process this form (On
submit, send the form-data to a action’s file)
68
Method= Get/Post
69
Text box
<form>
Age:<input type=text name=“age” size=2><br>
First name:<input type=text name =“first” size=10><br>
Last name:<input type=text name =“last” size=30><br>
Password:<input type=password name=“real name” size=10><br>
<button type="button">Click Me!</button>
</form>
70
Fieldset and legend
</body>
</html>
05/04/2020 Department of CIS 73
Ex.2
76
Ex. 3
<fieldset id="group2">
<legend> Medium :</legend>
<input type="radio" value="" name="group2">Sinhala<br>
<input type="radio" value="" name="group2">Tamil<br>
<input type="radio" value="" name="group2">English<br>
</fieldset>
</form>
</body>
05/04/2020 </html> Department of CIS 78
Cont..
<form>
What size pizza?
<p>
<input type=radio name="pizza size" value="S">small <br>
<input type=radio name="pizza size" value="M">Medium <br>
<input type=radio name="pizza size" value="L">Large <br>
</form>