Htmldca
Htmldca
Elements:
The first set of elements to look at the HTML
phrase elements, which are used to add
structural information to text fragments, rather
than entire lines or paragraph.
Elements Description
<b> and </b> // Bold the text
<i> and </i> // Italic the text
<u> and </u> // Underline the
text
<center> and </center> // Center the
text
<strike> and </strike> //
Strike through
<sub> and </sub> //subscript
<sup> and </sup> //Superscript
example
<html>
<head><title>Phrase element</title>
</head>
<body>
<center>this is center text</center><br>
<b>this is bold text</b><br>
<u>this is underline text</u><br>
<i>this is italic text </i><br>
</body>
</html>
<P> Paragraph Tag
<p> tag is the paragraph tag and marks the beginning
of a new paragraph. The End tag of <p> is </p>. It is
optional and can be used to mark the end of the
paragraph.
<h1>heading 1</h1>
<h2>heading 2</h2>
<h3>heading 3</h3>
<h4>heading 4</h4>
<h5>heading 5</h5>
<h6>heading 6</h6>
example
<html>
<head>
<title>sit</title>
</head>
<body>
<h1>heading 1</h1>
<h2>heading 2</h2>
<h3>heading 3</h3>
<h4>heading 4</h4>
<h5>heading 5</h5>
<h6>heading 6</h6>
</body>
</html>
Horizontal Rule Tag
The Horizontal Rule tag or the, <hr> tag
is used to draw a horizontal line. It does
no have an End tag.
The <hr> tag automatically introduces a
line break. In that we can specify the
thickness of the line.
The size attribute allows you to define the
thickness of the line to be drawn.
The NOSHADE attribute displays the line
in dark gray.
example
<html>
<head>
<title>hr</title>
</head>
<body>
<hr size = “1”>
<hr size = “3”>
<hr size = “10”>
<hr size = “10” noshade>
<hr size=“20” >
<hr size=“20” noshade>
</body>
</html>
BODY
The BODY tag specifies the main content of a
document. You should put all content that is to
appear in the web page between the <BODY> and
</BODY> tags.
<BODY
BACKGROUND="bgURL"
BGCOLOR="color"
TEXT="color"
LINK="color"
ALINK="color"
VLINK="color"
ONLOAD="loadJScode"
ONUNLOAD="unloadJScode"
ONBLUR="blurJScode"
ONFOCUS="focusJScode"
CLASS="styleClass" >
...
</BODY>
ADDING COLOR TO THE HTML PAGE
The actual text of the page is enclosed within this tag. By
using attributes with the <body> tag, it is possible to
change the background color, add a background picture,
specify text color, and specify the color of links.
BGCOLOR Attributes:
This attribute is used with the <body> tag to specify
the background color for the page. HTML allows you to
specify color in two ways.
For example:
<body bgcolor=”red”>
OR
<body bgcolor=”ff0000”>
Six-digit hexadecimal numbers represent the red, blue and
green components used to form the color.
For example, the RGB value for white is FFFFFF, red is
FF0000, yellow is FFFF00 andRed blue green
so on
BACKGROUND="bgURL"
<FONT
COLOR="color"
FACE="fontlist"
POINT-SIZE="pointSize"
SIZE="number"
WEIGHT="boldness"
>
...
</FONT>
COLOR Attributes
This attributes allows you to specify
the color in which the text should be
displayed. Color names or their
corresponding RGB codes can be
used.
For example: <font color = “red”>
red </font>
SIZE Attributes
HTML allows you to display text in
seven different font sizes. The
smallest is size 1 and the largest size
7.
For example:
<font size= “2” > html </font>
FACE Attributes
This attributes is used to specify the font
to be used to display text. Most browser
supports almost all the commonly used
fonts. If you use a font that is not
support by a browser, then the text will
be displayed in the default font.
. For example:
<font face = “Arial” > SIT Computer
Center</font>
EXAMPLE
<html>
<head><title>font
example</title></head>
<body>
<font face=“times new roman” size=7
color=“red”>sit welcomes you</font>
</body>
</html>
MARQUEES TAG
By using this tag you can scrolling the
text across the screen just like the
advertisement or flash news on
Television. To use this tag, enclose the
text with in the <marquee> and
</marquee> tags.
Note: The Marquees tag work only on
Internet Explorer.
For example:
<marquee> sample text </marquee>
BLINK TAG
By using this tag you can blink the
text on the screen. To use this tag,
enclose the text with in the <blink>
and </blink> tag.
Note: The Blink tag work only on
Netscape Navigator.
Example:
<blink>blinking text</blink>
directory list
The DIR tag is intended to display a list
of short items such as in a directory
listing.
To mark the individual items within the
list, use the LI tag.
A single list item can contain additional
paragraphs, marked with the P tag.
Syntax
<DIR>
....
</DIR>
Example
<html><body>
<P>The directory structure is:</P>
<DIR>
<LI>composer
<DIR>
<LI>editing.htm
<LI>publishing.htm
</DIR>
<LI>navigator
<DIR>
<LI>userguide.htm
<LI>javascript.htm
</DIR>
<DIR>
</body></html>
ordered list
The OL tag displays an ordered, or numbered,
list. The default numbering style is determined
by the browser, but you can use the tag's
TYPE attributes to change the numbering
sequence and numbering style.
Use the LI tag to designate the individual list
items.
Syntax
<OL
START="value"
TYPE="A"|"a"|"I"|"i"|"1"
>
...
</OL>
START="value"
indicates the starting number for the list. The
number must be a positive integer.
TYPE
defines the type of numbering sequence used for
<html>
<body>
<P>The following steps outline how to create
HTML files:</P>
<OL START="3" TYPE="I">
<LI> Use a text editor or Netscape Composer to
create your HTML file.
<LI> Put the HTML files on a web server.
<LI> Test the files by viewing them in a web
browser.
</OL>
</body>
</html>
unordered list
The UL tag displays a bulleted list. You can use the
tag's TYPE attribute to change the bullet style.
Use the LI tag to designate the individual list items
in the list.
Syntax
<UL TYPE="CIRCLE"|"DISC"|"SQUARE“>
TYPE
defines the type of bullet used for each list item.
The value can be one of the following:
<html>
<body>
<P>Netscape Composer offers the following
benefits</P>
<UL TYPE=“SQUARE”>
<li>Edit web pages directly in Navigator
<li>Easy options for setting background and
link colors
<li>As easy to use as any text editor
<li> No need to learn HTML
</UL>
</body>
</html>
Nested list
Example:
<html>
<body>
<dl>
<ol>
<li> <dt>html
<dd>this is the hyper text markup
language
</ol>
</dl>
</body>
</html>
TABLE
The TABLE tag defines a table.
Inside the TABLE tag, use the TR tag to define rows in the
table, use the TH tag to define row or column headings,
and use the TD tag to define table cells.
Syntax
<TABLE
ALIGN="LEFT|RIGHT"
BGCOLOR="color"
BORDER="value"
CELLPADDING="value"
CELLSPACING="value"
HEIGHT="height"
WIDTH="width"
COLS="numOfCols"
HSPACE="horizMargin"
VSPACE="vertMargin"
>
...
</TABLE>
ALIGN
specifies the horizontal placement of the
table.
LEFT aligns the table on the left (the
default). The content following the table
flows to the right of the table.
RIGHT aligns the table on the right. The
content following the table flows to the
left of the table.
CENTER aligns the table in the center.
Content does not flow on either side.
BGCOLOR="color"
sets the color of the background for the
table. This color can be overridden by a
BGCOLOR tag in the TH, TR, or TD tags.
BORDER="value"
indicates the thickness, in pixels, of the
border to draw around the table. Give the
value as an integer. A value of 0 means
the table has no border.
CELLPADDING="value"
determines the amount of space, in pixels,
between the border of a cell and the
contents of the cell. The default is 1.
CELLSPACING="value"
determines the amount of space, in pixels,
between individual cells in a table. The
default is 2.
WIDTH="width"
defines the width of the table. The
default is the optimal width determined
by the contents of each cell. The width
value can be a number of pixels, given as
an integer, or a percentage of the width
of the page or parent element, given as
an integer followed by the percent sign.
HEIGHT="height"
specifies the height of the table. The
default is the optimal height determined
by the contents of each cell. The height
value can be a number of pixels, given as
an integer, or a percentage of the height
of the page or parent element, given as
an integer followed by the percent sign.
CAPTION
The CAPTION tag defines a caption for a
table. Place the CAPTION tag within the
TABLE tag but not inside the TD or the TR
tags, which indicate table cells and table
rows respectively. This tag used within
TABLE tag.
Syntax
<CAPTION
ALIGN="BOTTOM"|"TOP">...</CAPTION>
ALIGN
specifies the placement of the caption within a
table.
<TR
ALIGN="CENTER|LEFT|RIGHT"
VALIGN="BASELINE|BOTTOM|MIDDLE|TOP"
BGCOLOR="color"
>
...
</TR>
ALIGN
specifies the horizontal placement of the table:
CENTER centers the table .
LEFT aligns the table to the left (the default).
RIGHT aligns the table to the right.
VALIGN
specifies the vertical placement of the content in the cell:
BASELINE aligns the content with the cell's baseline.
BOTTOM aligns the content with the cell's bottom.
MIDDLE centers the content within the cell (the default).
TOP aligns the content with the cell's top.
BGCOLOR="color"
sets the default color of the background of the table row
TD
(table data)
The TD tag specifies text in a cell in a table.
Use the TD tag inside a TR tag inside a
TABLE tag.
You can set the background color of a cell by
specifying its BGCOLOR attribute.
To specify the distance between cells, set
the CELLSPACING attribute in the TABLE
tag. To specify the distance between the
borders of each cell and its contents, set the
CELLPADDING attribute in the TABLE tag.
If a cell is empty, that is, the <TD> tag is
immediately followed by the </TD> tag, the
space occupied by the cell in the table is
completely empty.
Syntax
<TD
ALIGN="CENTER|LEFT|RIGHT"
VALIGN="BASELINE|BOTTOM|MIDDLE|
TOP"
BGCOLOR="color"
COLSPAN="value"
ROWSPAN="value"
HEIGHT="pixelHeight"
WIDTH="pixelWidth"
NOWRAP="value"
>
...
</TD>
TH
(table heading)
The TH tag specifies a table cell whose contents
are usually displayed in a bolder font than those
of regular table cells. The intent of the TH tag is
that you use it for column or row headings.
Syntax
<TH
ALIGN="CENTER|LEFT|RIGHT"
VALIGN="BASELINE|BOTTOM|MIDDLE|TOP"
BGCOLOR="color"
COLSPAN="value"
ROWSPAN="value"
HEIGHT="pixelHeight"
WIDTH="pixelWidth"
NOWRAP
>
...
</TH>
Example:
<html>
<head>
<title>SIT Table</title>
</head>
<body>
<table border="1" cellpadding="2" width="50%"
cellspacing="2">
<tr>
<th width="50%">Name</th>
<th width="50%">State</th>
</tr>
<tr>
<td width="50%">sit</td>
<td width="50%">tn</td>
</tr>
<tr>
<td width="50%">iit</td>
<td width="50%">chennai</td>
</tr>
</table>
</body>
<html>
<head> <title>SIT Table</title> </head>
<body>
<TABLE ALIGN="center" bgcolor="#FFFF00"
BORDER="4" CELLPADDING="2" CELLSPACING="2"
HEIGHT="10%" WIDTH="342">
<tr>
<th width="162" >Name</th>
<th width="190" colspan="3" >State</th>
</tr>
<tr>
<td width="15" >sit</td>
<td width="57" >tn</td>
<td width="55">india</td>
<td width="57">620010</td>
</tr>
<tr>
<td width="162">iit</td>
<td width="57">chennai</td>
</tr>
</table>
</body>
</html>
Forms
The FORM tag creates an HTML form. The form can
contain interface elements such as text fields,
buttons, checkboxes, radio buttons, and selection
lists that let users enter text and make choices.
With the form tag you can add to your web pages a
guestbook, order forms, surveys, get feedback or
whatever.
Syntax
<FORM
ACTION="serverURL"
ENCTYPE="encodingType"
METHOD="GET"|"POST"
NAME="formName"
ONRESET="JScode"
ONSUBMIT="JScode"
TARGET="windowName"
>
...
</FORM>
The ACTION attribute is required if any action is
to occur when the user presses a "Submit" button
in the form.
METHOD
specifies how information is sent to program
invoked by submitting the form.
GET (the default) appends the input information to the URL
POST sends the input information in a data body that are available .
NAME="formName"
specifies the name of the form. The name is
not displayed on the form.
ONRESET="JScode"
specifies JavaScript code that executes
when a user resets the form by using a RESET
button.
ONSUBMIT="JScode"
specifies JavaScript code that executes
when a user submits the form by clicking a
"Submit" button.
TARGET="windowName"
specifies the window that displays the data
The simple Controls:
Buttons
Text Boxes
Password Control
Check Boxes
Radio Buttons
TEXT AREA
Menu Controls
Buttons
A button apears in the form. You must specify JavaScript
code as the value of the ONCLICK attribute to determine
what happens when the user clicks the button.
Syntax
<INPUT TYPE="BUTTON"
NAME="buttonName"
VALUE="buttonText"
ONCLICK="JScode"
>
TYPE = SUBMIT - submit of course, sends the
data...
TYPE=RESET -clears the form.
NAME="buttonName"
specifies the name of the button. The name does not
appear in the form.
VALUE="buttonText"
specifies the text to be displayed in the button.
ONCLICK="JScode"
specifies JavaScript code to execute when a user
Text Boxes
A text element is a single line text input field in
which the user can enter text.
Syntax
<INPUT TYPE="TEXT"
MAXLENGTH="maxChars"
NAME="name"
SIZE="lengthChars"
VALUE="text"
>
MAXLENGTH="maxChars"
specifies the maximum number of characters a
text box can accept.
NAME="name"
<form>
Enter the Password<input type="password"
name="userpass" value size="15">
</form>
Check Boxes
These boxes are used to enable or
disable as option. In HTML, this
boxes can be created by using:
<FORM> <INPUT
TYPE="checkbox" NAME="Ed”
VALUE="YES">Ed Holleran
</FORM>
Radio Buttons
These are used to allow the user to choose one of
the options displayed. To create radio buttons, the
attribute TYPE is given the value RADIO.
The VALUE attribute is used to specify the value
to be stored in the variable of an option is selected.
CHECKED indicates that the radio button is
selected. .
For Example:
<form>
<input type="radio" value="V1" name="R1">Radio
Button
</form>
TEXT AREA
These controls are used when the
input from the user may extend to
several lines. In this case, instead of
the <input> tag, <textarea> and
</textarea> tags are used.
For Example:
<textarea rows="4" name="S1"
cols="20"></textarea>
Menu Controls
Menu controls are like the drop-down lists used
in window dialog boxes. Such menu controls can
be created using the <select> and the
</select> tags. The <option> tag is used to
specify the different option in the list. By using
<select> tag with the size attribute.
For Example:
<NOFRAMES>...</NOFRAMES>
For example:
Frame HTML:
<html>
<head>
<title>SIT-Frames</title>
</head>
<frameset rows="64,*">
<frame name="banner" scrolling="no" noresize
target="contents" src="h1.htm">
<frameset cols="150,*">
<frame name="contents" target="main" src="h2.htm">
<frame name="main" src="home.htm">
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't
support them.</p>
</body>
</noframes>
</frameset>
</html>
Banner Window HTML:
<html>
<head>
<title>SIT COMPUTER
CENTER</title>
<base target="contents">
</head>
<body>
<h1 align="center">SIT
COMPUTER CENTER</h1>
</body>
</html>
Content Window HTML:
<html>
<head>
<title>home</title>
<base target="main">
</head>
<body>
<p><a href="home.htm">home</a></p>
<p><a href="fr1.htm">frame page
1</a></p>
<p><a href="fr2.htm">frame page
2</a></p>
</body>
</html>
Main Window HTML: (HOME PAGE)
<html>
<head>
<title>SIT HOME</title>
</head>
<body>
<h1 align="center"><font size="6"
face="Staccato222 BT"><u>Welcome To SIT
Computer Center</u></font></h1>
<p align="center"><span style="background-color:
#C0C0C0"><font face="Footlight MT Light"
size="6" color="#000080">Internet And JAVA
Programming</font></span></p>
<p align="right"><b><font face="Margaret"
size="5">-SITCC Team
Members</font></b></p>
</body>
</html>
STYLE
The STYLE tag specifies a style sheet.
There are two types of style sheets:
Syntax
<STYLE
TYPE="stylesheetType">
...
</STYLE>
Elements of Styles
Font name
Font Size
Text Indent
Margin (left & right)
Background color
Text color
Text alignment
The style is Used Within
<HEAD> and </HEAD>.
example
<HTML>
<HEAD>
<TITLE>Introduction to Style Sheets</TITLE>
<STYLE TYPE="text/css" >
BODY { color : white}
P { color : blue;
font-size : 12pt;
font-family : Arial}
H1 { color : red;
font-size : 18pt}
</STYLE>
</HEAD>
Cascading Style Sheet
Type of CSS
1. Inline Style
2. External Style
3. Internal Style
Inline Style
The in line style type is defined within the
body of the HTML itself.
Example:
<html>
<head><title>In line Style</title></head>
<body> <h1 style=font-size:24pt >
<h1> this in line style</h1>
</body>
</html>
External Style
The external style sheet it is stored in a
separate file.
This style sheet linked by HTML through LINK
Tag.
Syntax:
P {font-size:18pt; margin-left:20pt;}
H1 {color : blue;}
Internal Style
<HTML>
<HEAD>
<TITLE>Introduction to Style Sheets</TITLE>
<STYLE TYPE="text/css" >
BODY { color : white}
P{ color : blue;
font-size : 12pt;
font-family : Arial}
H1 { color : red;
font-size : 18pt}
</STYLE>
</HEAD>
<body>
This is internal style sheet
</body>
</html>