Beruflich Dokumente
Kultur Dokumente
DAY 1
2
OBJECTIVES
Getting Started With HTML
Introducing HTML
How Web pages work
Introduction to Tags
Structure of HTML page
Creating a Web Page
Introduction table, tr, td tags.
Paragraphs and Line breaks
Headings
Creating Ordered and Unordered List
Text Formatting And Alignment
Boldfaces and Italics
Font Size, Color and Typeface
Special Characters
3
OBJECTIVES
Using Links & Images
Style Sheet
Purpose of Style Sheet
Style Rules
Attaching Style Sheet
Defining classes
Div tag, Span Tag
Using Span
Developing Forms
Introducing Forms
Using Standard Form Controls
4
WHAT IS WORLD WIDE WEB?
The World Wide Web (Web) is a network of information resources.
The Web relies on three mechanisms to make these resources readily
available to the widest possible audience:
A uniform naming scheme for locating resources on the Web (e.g., URIs).
Protocols, for access to named resources over the Web (e.g., HTTP).
Hypertext, for easy navigation among resources (e.g., HTML).
5
INTRODUCING HTML
What is HTML
6
INTRODUCING HTML
What is HTML
7
Introducing HTML
Uses of HTML
Publish online documents with headings, texts, tables, lists, photos, etc.
Retrieve online information via hypertexts links.
Design forms for conducting transactions with remote services, for use in
searching for information, making reservations, ordering products, etc.
Include spread-sheets, video clips, sound clips, and other applications
directly in their documents.
8
HOW TO ACCESS AN WEB PAGE
Click To
Proceed With
The Steps
9
Double Click
on the
Internet
Explorer
button
10
Browser
Window
Opens
11
http://www.google.co.in
12
Web Server Internet
http://www.google.co.in Request
Request
13
Internet
Web Server
Web Page
Web Page
HTML files
All tag start with < (less than symbol) and end with
> (greater than symbol)
Tags which mark a beginning have no / (front slash).
Tags which mark an ending have a / immediately after <,
as in </.
16
INTRODUCING HTML
Example on Tag
Sample Tags
17
INTRODUCING HTML
Explanation of the HTML code
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
18
INTRODUCING HTML
Explanation of the HTML code
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
19
INTRODUCING HTML
Explanation of the HTML code
Indicates to the browser that this is an HTML
document.
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
20
INTRODUCING HTML
Explanation of the HTML code
HTML document is divided into two sections.
1. <HEAD> . </HEAD>
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
21
INTRODUCING HTML
Explanation of the HTML code
HTML document is divided into two sections.
2. <BODY> . </BODY>
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
22
INTRODUCING HTML
Explanation of the HTML code
Shows the contents in the browser title bar.
Generally placed inside Head tag.
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
23
INTRODUCING HTML
Explanation of the HTML code
Indicates comment tag. Can be placed anywhere
in the document.
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
24
INTRODUCING HTML
Explanation of the HTML code
<HTML>
<HEAD>
<TITLE> My Home Page </TITLE>
</HEAD>
<!-- Written by Manas K Sahoo -->
<!-- Created: 30-May-2007 -->
<!-- Organization: IBM -->
<BODY>This is where the text goes.
</BODY>
</HTML>
25
INTRODUCING HTML
Kinds of Tags
26
PARAGRAPHS
&
LINE BREAKS
27
LINE SEPARATORS
Tags used for separating one line with other can be classifies as follows:-
1. <P> tag
2. <BR> tag
3. <HR> tag
28
THE <P> TAG
Normally all text in an HTML document is treated like one long
paragraph. Indented or blank lines which normally indicate start of
paragraphs in text are ignored.
To separate your text into paragraphs use the <P> tag.
The <P> tag forces an end of line and forces a blank line before the
next paragraph.
29
Code Snippet To Fulfill the Requirement
30
<p> tag forces an end of line and forces a blank line before the next paragraph.
31
<p> tag forces an end of line and forces a blank line before the next paragraph.
33
THE <BR> TAG
Used to control the line breaks.
Use single spacing among the lines unlike <p> tag that uses double
spacing among the paragraph.
Does not have a closing braces.
34
Code Snippet To Fulfill the Requirement
35
Forces line break with one line spacing between two lines.
36
Output
37
THE <HR> TAG
The <HR> tag draws a horizontal line across the page.
It acts a paragraph break.
There is no need to use the <BR> before or after the <HR> tag.
38
REQUIREMENT ANALYSIS
39
Code Snippet To Fulfill the Requirement
40
Draws a horizontal line across the page.
41
<HR> TAG ATTRIBUTES
1. Color Attribute
How To
Use
<hr color=red>
<hr color=blue>
<hr color=pink>
42
<HR> TAG ATTRIBUTES
2. Width Attribute
How To
Use
<hr width=50%>
<hr width=500>
Default alignment
of HR is center.
43
<HR> TAG ATTRIBUTES
3. Align Attribute
How To
Use
<hr align=left width=50%>
<hr align=center
width=50%>
44
<HR> TAG ATTRIBUTES
4. Size Attribute
How To
Use
<hr size=5>
45
THE HEADINGS TAGS
To add headings in the HTML document use <Hn> tag where, n
represent number from 1 to 6.
47
UNORDERED LIST
When the list of contents that you want to display dont have to follow any
sequence then you can use Unordered list.
Each item in the unordered list is indented.
<UL>
48
UNORDERED LIST
When the list of contents that you want to display dont have to follow any
sequence then you can use Unordered list.
Each item in the unordered list is indented.
<LI>
49
UNORDERED LIST
<HTML>
<BODY> Check Out
<H3>List of Electronic Products</H3> An Example
<UL>
<LI>T.V.</LI>
<LI>VCD</LI>
<LI>DVD</LI>
<LI>REFRIGERATOR</LI>
<LI>WASHING MACHINE</LI>
<LI>MICRO OVEN</LI>
</UL>
</BODY>
</HTML>
50
Check Out The
Output
51
ORDERED LIST
When the list of contents that you want to display have to follow a
sequence.
Each item in the ordered list is indented.
For Example, creating a list of students based on their merit.
<OL>
52
ORDERED LIST
<HTML>
<BODY>
<H3>List of Fortune 500 Companies Industry: Computers, Office Equipment Year 2006 Survey </H3>
<OL>
<LI>IBM</LI>
Check Out An
<LI>HP</LI> Example
<LI>Dell</LI>
<LI>NEC</LI>
<LI>Fujitsu</LI>
<LI>Canon</LI>
</OL>
</BODY>
</HTML>
53
Check Out The
Output
54
TEXT FORMATTING AND ALIGNMENT
55
TEXT FORMATTING
Character Styles
1. <PRE> tag
2. <BLOCKQUOTE> tag
3. <ADDRESS> tag
56
TEXT FORMATTINGCharacter
(CONTD.) Styles
1. <PRE> tag
57
TEXT FORMATTINGCharacter
(CONTD.) Styles
<pre>
This is should be the end of my first paragraph in HTML.
58
TEXT FORMATTING (CONTD.)
Output
59
TEXT FORMATTINGCharacter
(CONTD.) Styles
2. <BLOCKQUOTE> tag
60
TEXT FORMATTINGCharacter
(CONTD.) Styles
61
TEXT FORMATTING (CONTD.)
Output
62
TEXT FORMATTINGCharacter
(CONTD.) Styles
3. <ADDRESS> tag
63
TEXT FORMATTINGCharacter
(CONTD.) Styles
64
TEXT FORMATTING (CONTD.)
Sample Output
65
TEXT FORMATTINGCharacter
(CONTD.) Styles
66
TEXT FORMATTING (CONTD.)
Character Styles
67
TEXT FORMATTINGCharacter
(CONTD.) Styles
68
TEXT FORMATTING (CONTD.)
Character Styles
69
TEXT FORMATTING (CONTD.)
Font Tag
70
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
1. Size
2. Color
3. Face
71
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
1. Size
72
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
1. Size
73
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
74
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
75
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color Sample
Generic
i. Generic Coloring System Basic Colors
76
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
RGB stands for Red, Green, Blue. Each can have a value
from 0 (none of that color) to 255 (fully that color).
77
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
78
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
XX XX XX
Red Green Blue
79
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
2. Color
80
TEXT FORMATTING (CONTD.)
81
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
3. Face
82
TEXT FORMATTING (CONTD.)
Attributes of Font Tag
3. Face Example
Code Output
Snippet
83
TEXT FORMATTINGSpecial
(CONTD.)
Characters
Exampl
e
<html>
<body>
<h2><b><MARQUEE></b> is used to scroll the
enclosing text.</h2>
</body>
</html>
84
TEXT FORMATTING (CONTD.)
Special Characters
Output
85
USING LINKS
&
IMAGES
86
USING LINKS
87
USING LINKS (CONTD.)
88
EXAMPLE OF A HYPERLINK
<html>
<head> ---- other information within body
<title>Example of a Hyperlink</title> tag-------
<head> </body>
The word IBM will be highlighted , and
<body> </html> on clicking IBM the user will be taken to
the w3 pages of IBM, the page will be
opened on the same window
<a href=http://w3.IBM.com> IBM</a>
<a href=http://w3.IBM.com The word IBM will be highlighted , and
target=_blank>IBM</a> on clicking IBM the user will be taken to
the w3 pages of IBM, the page will be
opened on a new window.
89
EXAMPLE OF NAMING A LINK AND ACCESSING IT
<html> </body>
<body> </html>
<a name=locations>
locations</a>
Kolkata, Bangalore, Hyd, Pune, On Clicking on IBM Location in India you
will be linked to the section which has
Chandigarh, Gurgoan been named as locations
90
EMBEDDING IMAGES
91
EMBEDDING IMAGES ( CONTD.)
92
EMBEDDING IMAGES(CONTD.)
93
EXAMPLE OF AN EMBEDDED IMAGE
<html>
<body>
<p>
An image
<img src=home.gif"
align="bottom" width="48" height="48">
in the text
</p>
<p>
An image
<img src ="home.gif"
align="middle" width="48" height="48">
in the text
</p> </body> </html>
94
HTML TABLE
Table allows to organize and present data in an orderly and concise
manner.
Tabular structures were introduced with HTML 3.2.
A table can contains wide variety of information, such as headers,
anchors, lists, paragraphs, forms, images, preformatted text and even
nested tables.
HTML tables are composed of rows and columns.
95
REQUIREMENT ANALYSIS
96
Code Snippet To Fulfill the Requirement
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
97
For starting a table
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
98
It is an attribute of table tag to specify the thickness of the border of the table in
pixels.
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
99
Table Border set to 1
100
If Table Border set to 5
101
For starting a table
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
103
For starting a table caption, It is like a title which resides outside the border of
the table. It is an optional attribute.
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
105
For starting a table row
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
106
For starting a table row
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
108
For providing a table heading. By default the header cell will appear in bolder
type and the default alignment is center.
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
109
For providing a table heading. By default the header cell will appear in bolder
type and the default alignment is center.
<html> <tr>
<body>
<td>SWG</td>
<table border=1>
<td>Software Group</td>
<caption>IBM Strategic Business Unit</caption>
</tr>
<tr>
<th>Unit Name</th> </table>
<th>Description</th> </body>
</tr> </html>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
111
For providing the table data. By default the alignment is left.
<tr>
<html> <td>SWG</td>
<body> <td>Software Group</td>
<table border=1>
</tr>
<caption>IBM Strategic Business Unit</caption>
</table>
<tr>
</body>
<th>Unit Name</th>
<th>Description</th> </html>
</tr>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
112
For providing the table data. By default the alignment is left.
<tr>
<html> <td>SWG</td>
<body> <td>Software Group</td>
<table border=1> </tr>
<caption>IBM Strategic Business Unit</caption>
</table>
<tr>
</body>
<th>Unit Name</th>
<th>Description</th>
</html>
</tr>
<tr>
<td>BCS</td>
<td>Business Consultancy Services</td>
</tr>
114
REQUIREMENT ANALYSIS
115
Code Snippet To Fulfill the Requirement
116
This attribute is used to span cell more than one row. In this case it will span the
1st column into four rows including the current row.
117
This cell is spanned to 4 rows
118
The 3rd column is spanning more 4 rows including the current row..
119
This cell is spanned to 4 rows
120
Analyzing The Code
<table border="1">
<caption>ROWSPAN Example</caption>
121
122
Analyzing The Code
<table border="1">
<caption>ROWSPAN Example</caption>
<tr><th>Group Name</th>
<th>SubGroup Name</th>
<th>Group Name</th>
<th>SubGroup Name</th>
</tr>
123
124
Analyzing The Code
<table border="1">
<caption>ROWSPAN Example</caption>
<tr><th>Group Name</th>
<th>SubGroup Name</th>
<th>Group Name</th>
<th>SubGroup Name</th>
</tr>
<TR>
<td ROWSPAN="4"> Group 1</td> <td>1a</td>
<td ROWSPAN="4"> Group 2</td><td>2a</td>
</tr>
125
126
Analyzing The Code
<table border="1">
<tr>
<caption>ROWSPAN Example</caption>
<td>1b</td>
<tr><th>Group Name</th>
<td>2b</td>
<th>SubGroup Name</th>
</tr>
<th>Group Name</th>
<th>SubGroup Name</th>
</tr>
<TR>
<td ROWSPAN="4"> Group 1</td> <td>1a</td>
<td ROWSPAN="4"> Group 2</td><td>2a</td>
</tr>
127
128
Analyzing The Code
<table border="1">
<tr>
<caption>ROWSPAN Example</caption>
<td>1b</td>
<tr><th>Group Name</th>
<td>2b</td>
<th>SubGroup Name</th>
</tr>
<th>Group Name</th>
<tr>
<th>SubGroup Name</th>
<td>1c</td>
</tr>
<td>2c</td>
<TR>
</tr>
<td ROWSPAN="4"> Group 1</td> <td>1a</td>
<td ROWSPAN="4"> Group 2</td><td>2a</td>
</tr>
129
130
Analyzing The Code
<table border="1">
<tr>
<caption>ROWSPAN Example</caption>
<td>1b</td>
<tr><th>Group Name</th>
<td>2b</td>
<th>SubGroup Name</th>
</tr>
<th>Group Name</th>
<tr>
<th>SubGroup Name</th>
<td>1c</td>
</tr>
<td>2c</td>
<TR>
</tr>
<td ROWSPAN="4"> Group 1</td> <td>1a</td>
<tr>
<td ROWSPAN="4"> Group 2</td><td>2a</td>
<td>1d</td>
</tr>
<td>2d</td>
</tr>
</table>
131
132
Requirement
RequirementAnalysis
133
Code Snippet To Fulfill the Requirement
136
It will span the 3rd column into two more nested columns.
<tr>
<td>A001</td><td>AAA</td>
<table border="1">
<caption>COLSPAN Example</caption> <td>150</td><td>00</td>
<tr> </tr>
<th colspan="5"> Product Description</th>
<tr>
</tr>
<tr> <td>B002</td><td>BBB</td>
<th> Product Code</th> <td>120</td><td>99</td>
<th> Product Name</th>
</tr>
<th colspan="2"> Price</th>
</tr> <tr>
<tr>
<td>C002</td><td>CCC</td>
<td colspan="2"> </td><td>Rs.</td><td>Ps.</td>
</tr>
<td>250</td><td>00</td>
</tr>
</table>
137
This cell is spanned to 2 columns
138
It will span the 3rd row 1st column into two columns. In other words, it will merge
the 1st two columns of the 3rd row.
<tr>
<td>A001</td><td>AAA</td>
<table border="1"> <td>150</td><td>00</td>
<caption>COLSPAN Example</caption> </tr>
<tr>
<tr>
<th colspan="5"> Product Description</th>
</tr> <td>B002</td><td>BBB</td>
<tr> <td>120</td><td>99</td>
<th> Product Code</th>
</tr>
<th> Product Name</th>
<th colspan="2"> Price</th> <tr>
</tr> <td>C002</td><td>CCC</td>
<tr>
<td colspan="2"> </td><td>Rs.</td><td>Ps.</td>
<td>250</td><td>00</td>
</tr> </tr>
</table>
139
This cell is spanned to 2 columns
140
SOME MORE ATTRIBUTES OF TABLE TAG
Cellspacing - The CELLSPACING attribute creates a space, or border,
of the specified number of pixels, between each cell.
Cellpadding - The CELLPADDING attribute separates text of the cell
from the cell border with a padding with the specified number of
pixels.
Width - specify the width of the table
141
USING CELLSPACING ATTRIBUTE
<html>
<body>
<table cellspacing=25" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
142
USING CELLSPACING ATTRIBUTE
<html>
<body>
<table cellspacing=25" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
143
Vertical Cell spacing
144
USING CELLPADDING ATTRIBUTE
<html>
<body>
<table cellpadding=25" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
145
USING CELLPADDING ATTRIBUTE
<html>
<body>
<table cellpadding=25" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
146
Horizontal Cell padding
Vertical Cell padding
147
USING WIDTH ATTRIBUTE
<html>
<body>
<table width=80%" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
148
USING WIDTH ATTRIBUTE
<html>
<body>
<table width=80%" border="1">
<tr><th>Table Heading 1</th>
<th>Table Heading 2</th>
</tr>
<tr><td>Table Contents 1</td>
<td>Table Contents 2</td>
</tr>
</body>
</html>
149
Cell Width
150
if Cell Width = 20%
151
TABLE ALIGNMENT RELATED ATTRIBUTE
HTML tables can be aligned on the page, and cell content can be aligned
within the cell.
LEFT
This attribute use to align Attribute
HORIZONTALLY is values CENTER
ALIGN are
RIGHT
TOP
This attribute use to align Attribute
VERTICALLY is values MIDDLE
VALIGN are
BOTTOM
153
WEB
STYLESHEETS
154
CASCADING STYLE SHEET
155
CASCADING STYLE SHEET (CONTD..)
156
BENEFITS OF A CASCADING STYLE SHEET
157
PARTS OF A CASCADING STYLE SHEET
158
INLINE STYLE SHEET
Inline style sheets are applied by coding style properties and values
inside the tags to which they apply.
An inline style sheet can appear inside any tag to directly set its style.
All that is required is to enclose the applicable style properties and
values inside a quoted style attribute.
Syntax
<tag style=property:value [;property:value]>
159
INLINE STYLE SHEET(CONTD.)
<html>
<body>
<pre>
<h1> Inline Style Sheet</h1>
<p style="font-size: 12pt; color: red">
This is line one
This is line two
This is line three
</p>
</body>
</html>
160
EMBEDDED STYLE SHEET
Embedded style sheets are used when a unique style is required for a
document.
Embedded style are defined in the <head> tag section by using the
<style> tag
When a large number of style settings are used on a Web page,
there is convenience in packaging the settings together in one place as
an embedded style sheet, rather than having them scattered as inline
style sheets throughout the document.
161
SYNTAX OF STYLE SHEET
162
EXAMPLE OF AN EMBEDDED STYLE SHEET
<html>
<head>
<style type="text/css">
hr {color: red}
</style>
</head>
<body>
<hr>
<hr>
</body>
</html>
163
EXTERNAL STYLE SHEET
Internal style sheets are used when a unique style is required for a
document.
Internal style are defined in the <head> tag section by using the
<style> tag
The different selectors, their properties and values should be defined
within the external style sheet.
The external style sheet should be saved within a file, with an
extension of .css
164
EXTERNAL STYLE SHEET
SecondPage.html
165
EXAMPLE OF EXTERNAL STYLE SHEET <html>
body {background-color: yellow}
h1 {font-size: 36pt} <head>
p {margin-left: 50px; background: pink; color:blue} <link rel="stylesheet" type="text/css" href="Mystyle.css" />
</head>
hr {color: red}
<body>
<h1> This header is 36 pt </h1>
Mystyle.css
<p> This paragraph has a left margin of 50 pixels<br>
The font color is blue<br>
The background color is pink
</p>
<hr>
</body>
</html>
MyPage.html
166
MULTIPLE STYLE SHEET
<html>
h3 { color: red; <head>
text-align: left; <link rel=stylesheet type=text/css
href=Mystyle.css>
font-size: 8pt }
<style type=text/css>
h3 {font-size: 20pt}
Mystyle.css
</style>
</head>
<body>
What will be <h3> This is a header </h3>
the Font size ---more text----
Of <h3> </body>
</html>
8pt or 20 pt??
MyPage.html
167
MULTIPLE STYLE SHEET CONTINUED
If some properties have been set for the same selector in different style sheets,
the values will be inherited from the more specific style sheet .
<html>
<head>
h3 { color: red; <link rel=stylesheet type=text/css
href=Mystyle.css>
text-align: left;
<style type=text/css> Font Size will be Inherited
</style>
Mystyle.css
</head>
Color: Red <body>
Text-align-left <h3> This is a header </h3>
---more text----
Font-size- 20pt
</body>
</html>
MyPage.html
168
SOME COMMON SELECTORS AND ATTRIBUTES
Selector property
H1,H2,H3.. font-size,Font-family,font-style , font-weight
Color, margin
P font-size,Font-family,font-style , font-weight
Color, Background-color,text-align, margin
HR color
169
CLASS SELECTOR
With the class selector you can define different <html>
styles for the same type of HTML element.
<head>
170
USES OF <DIV> TAG
<DIV> tag
171
USES OF <DIV> TAG
<DIV> tag
Example
172
USES OF <DIV> TAG
<DIV> tag
Output
173
USING <SPAN> IN CSS SPAN is a inline tag.
It is used to format small chunks of
data within another element.
Combining <span> tag with CSS
What is the allows us to create custom tags.
Utility of
<span> in
HTML
174
USING <SPAN> IN CSS (CONTD.) <html>
<head>
p { color: white ; background-color: black} <link rel="stylesheet"
type="text/css" href="Mystyle.css" />
.example1 {color:blue ; background-color: </head>
yellow ;font-family: "sans-serif"}
<body>
.example2 {color:red ; background-color: <p >
white ;font-family: times} This is the first line of the paragraph<br>
This is the second line of the paragraph<br>
<span class="example1">This is the third line of
Mystyle.css the paragraph<br> </span>
<span class="example2">This is the fourth line
of the paragraph<br> </span>
This is the fifth line of the paragraph
</p>
</body>
</html>
MyPage.html
175
DEVELOPING
HTML FORMS
176
FORM
177
FORM (CONTD.)
178
FORM CONTROLS
TextField:
Are used to accept user input. It is a single line input control.
CheckBox
Checkboxes are used when you want the user to select one or more options of a
limited number of choices.
RadioButton
Radio Buttons are used when you want the user to select one of a limited number of
choices.
Select
Are used when you want users to choose options from a selectable lists.
TextArea
Are used to accept user input. TextArea allows entry of multiple lines.
179
FORM CONTROLS (CONTD.)
PushButton
Each push button may have client side script associated with the element's
event attributes. When an event occurs (e.g., the user presses the button,
releases it, etc.), the associated script is triggered.
Submit Button
When activated, a submit button submits a form. A form may contain more
than one submit button.
Reset Button
When activated, a reset button resets all controls to their initial values.
180
FORM CONTROLS (CONTD)
Form
Component Tag Attribute Usage Output
TextField <input> type name value <input type="text" name="t1" value="Paul"> Paul
Checkbox <input> type name value <input type="checkbox" name="c1" value="v1">
RadioButton <input> type name value <input type="radio" name="r1" value="v2">
<select> name <select name="s1"><option value="v1">Display Select an item
ComboBox
<option> value item</option></select>
TextArea
<textarea> row col name <textarea name="n1" row="5" col="20">
Reset
<input type="reset" value="Reset">
181
FORM CONTROLS USING ATTRIBUTES:
INPUT Attribute definitions
type = text|password|checkbox|radio|submit|reset|file|hidden|image|button
This attribute specifies the type of control to create. The default value for this
attribute is "text".
name = cdata
This attribute assigns the control name.
value = cdata
This attribute specifies the initial value of the control. It is optional except when the
type attribute has the value "radio" or "checkbox".
size = cdata
This attribute tells the initial width of the control. The width is given in pixels except
when type attribute has the value "text" or "password". In that case, its value refers
to the (integer) number of characters.
182
FORM CONTROLS USING ATTRIBUTES:
INPUT Attribute definitions (Contd )
maxlength = number
When the type attribute has the value "text" or "password", this attribute
specifies the maximum number of characters the user may enter. This number may
exceed the specified size, in which case the user should offer a scrolling
mechanism. The default value for this attribute is an unlimited number.
Checked
When the type attribute has the value "radio" or "checkbox", this boolean
attribute specifies that the button is on.
src = uri
When the type attribute has the value "image", this attribute specifies the
location of the image to be used to decorate the graphical submit button.
183
FORM CONTROLS USING ATTRIBUTES:
SELECT Attribute definitions
name = cdata
This attribute assigns the control name.
size = number
If a SELECT element is presented as a scrolled list box, this attribute specifies the number
of rows in the list that should be visible at the same time.
Multiple
If set, this boolean attribute allows multiple selections. If not set, the SELECT element only
permits single selections.
184
PRE SELECTED OPTIONS:
Zero or more choices may be pre-selected for the user. Users should
determine which choices are pre-selected as follows:
If no OPTION element has the selected attribute set, the initial state has the
first option selected.
If one OPTION element has the selected attribute set, it should be pre-selected.
If the SELECT element has the multiple attribute set and more than one
OPTION element has the selected attribute set, they should all be pre-selected.
It is considered an error if more than one OPTION element has the selected
attribute set and the SELECT element does not have the multiple attribute set.
185
EXAMPLE OF A FORM
<html>
<tr><td>Qualification</td><td><select name=s>
<head>
<option >Select</option>
<title>
<option value=M.Sc>M Sc</option>
Form Example</title>
<option value=M.A.>MA</option>
</head>
<option value="other">other</option></select>
<body bgcolor=pink >
</td></tr>
<center>
<tr><td> <input type="submit" value="submit"> </td>
<h3> Data Entry Form</h3>
<td> <input type="reset" value="reset"> </td></tr>
<form>
</table>
<table>
</center>
<tr><td>Name</td><td> <input type="text" name="t1">
</td></tr> </form>
186
OUTPUT OF THE FORM
187
FIELDSET & LEGEND TAG
The fieldset tag is used to group the form elements whilst the legend
tag provides a label for the fieldset.
The HTML legend tag is used for labelling the fieldset element.
By using the fieldset tag and the legend tag, you can make your
forms much easier to understand for your users.
188
OUTPUT REQUIRED
189
CODE SNIPPET
<fieldset align="left">
<html>
<legend>Personal Info</legend>
<body>
Name : <input type="text">
<fieldset style="text-align:right;">
Age : <input type="text">
<legend><b>Address Details</b></legend>
Gender :
Favorite Address <input type="text" /><br/>
<input type="radio"
Least Favorite Address <input type="text" /><br/> name="r1">Male
Current Address <input type="text" /><br/> <input type="radio"
Your Next Address <input type="text" /><br/> name="r1">Female
</fieldset> </fieldset>
<br> </body>
</html>
190
<FIELDSET> TAG IS USED TO GROUP THE FORM ELEMENTS
<fieldset align="left">
<html>
<legend>Personal Info</legend>
<body>
Name : <input type="text">
<fieldset style="text-align:right;">
Age : <input type="text">
<legend><b>Address Details</b></legend>
Gender :
Favorite Address <input type="text" /><br/>
<input type="radio"
Least Favorite Address <input type="text" /><br/> name="r1">Male
Current Address <input type="text" /><br/> <input type="radio"
Your Next Address <input type="text" /><br/> name="r1">Female
</fieldset> </fieldset>
<br> </body>
</html>
191
<LEGEND> TAG IS USED GIVE A SUITABLE LABEL TO THE GROUP.
<fieldset align="left">
<html>
<legend>Personal Info</legend>
<body>
Name : <input type="text">
<fieldset style="text-align:right;">
Age : <input type="text">
<legend><b>Address Details</b></legend>
Gender :
Favorite Address <input type="text" /><br/>
<input type="radio"
Least Favorite Address <input type="text" /><br/> name="r1">Male
Current Address <input type="text" /><br/> <input type="radio"
Your Next Address <input type="text" /><br/> name="r1">Female
</fieldset> </fieldset>
<br> </body>
</html>
192
Given a Label using legend tag
193
SUMMARY
HTML is used for publishing web page.
A tag is a reference in an HTML document which describes the style and structure of the
document.
<TABLE> with <TR>,<TH>,<TD> tags are used to construct a tabular structure in
HTML.
To create a List of items in HTML, tags used are <OL>and <UL>.
Tags that separate from one line to others are <P>, <BR>, <HR>.
It is used to include preformatted text into your HTML document.
<BLOCKQUOTE> tag is used to include indented text in a document.
The purpose of Logical Character Style tags is to convey the basic semantic meaning of
a piece of text rather than the absolute appearance.
Physical Character Style tags is used to give your text a different look but exacting
look.
<Font> tag is used to change the font size, color and face in a document.
194
SUMMARY (CONTD.)
Special characters are those that has a special meaning in HTML and those
are not found on English keyboards.
HTML uses the <a> (anchor) tag to create a link to another document.
In Html images are defined by using the <img> tag
The <img> tag is a open tag ( does not have a </img>)
Web style sheets are a form of separation of presentation and content for
web design .
CSS syntax is made up of three parts: Selector, property and value
Internal style sheets are used when a unique style is required for a document.
Internal style are defined in the <head> tag section by using the <style> tag
195
SUMMARY (CONTD.)
Internal style sheets are used when a unique style is required for a document.
Internal style are defined in the <head> tag section by using the <style> tag
With the class selector you can define different styles for the same type of
HTML element
<Span> is a inline tag.
Span is used to format small chunks of data within another element.An HTML
form is a section of a document containing normal content, markup, special
elements called controls.
Some of the common controls are checkboxes, radio buttons, Textfields, etc.
Fieldset & Legend tags are used for grouping form elements and giving a
suitable name to the group respectively.
196
TEST YOUR UNDERSTANDING
197
TEST YOUR UNDERSTANDING (CONTD.)
3. The <style> tag should be embedded within:
a. <body>
b. <form>
c. <head>
d. <img>
4. With the _________selector you can define different styles for the same type of
HTML element.
a. Form
b. Button
c. Span
d. class
198
TEST YOUR UNDERSTANDING (CONTD.)
5. The ___________ attribute of table tag separates text from the cell border
a. CELLPADDING
b. CELLSPACING
c. BORDERSPACING
d. TABLESPACING
199
TEST YOUR UNDERSTANDING (CONTD.)
Match Group A with B
Group A Group B
a. <TR> i. Emphasizes the text enclosed within it.
200
REFERENCES
http://www.pierobon.org/iis/url.htm
http://w3schools.com/html
http://www.ology.org/tilt/cgh/ - Things to consider while developing
web page using HTML.
http://www.tizag.com/htmlT
http://www.1stsitefree.com
http://www.quackit.com/html
201