U1a. HTML
U1a. HTML
Prof. Pranav
Introduction to HTML
Contents:
•HyperText Mark Up Language:
•Languages used for website development
•HTML5: basic tags, formatting tags
•Adding images, Lists, Embedding multimedia in Web pages
•Inserting tables, Internal and External Linking
•Frames, Forms
Definitions
WWW – World Wide Web.
Usually paired
Objectives
<BODY BGCOLOR=“#FFFFFF”></BODY>
TEXT Color
<BODY BGCOLOR=“#FFFFFF”
TEXT=“#FF0000”></BODY>
VLINK=“#FF00FF”
ALINK=“FFFF00”> </BODY>
Using Image Background
The BODY element also gives you ability of setting an
image as the document’s background.
An example of a background image’s HTML code is as
follows:
3. In the “File Name” text box, type in the entire name of your
file (including the extension name .html).
Headings, Paragraphs, Breaks & Horizontal Rules
<UL>
</UL>
• List item …
• List item …
List Elements
You have the choice of three bullet types: disc(default), circle, square.
These are controlled in Netscape Navigator by the “TYPE” attribute for the
<UL> element.
<UL TYPE=“square”>
</UL>
List item …
List item …
List item …
List Elements
OL: Ordered List. Items in this list are numbered
automatically by the browser.
<OL>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
1. List item …
2. List item …
3. List item
You have the choice of setting the TYPE Attribute to
one of five numbering styles.
List Elements
TYPE Numbering Styles
1 Arabic numbers 1,2,3, ……
a Lower alpha a, b, c, ……
A Upper alpha A, B, C, ……
i Lower roman i, ii, iii, ……
I Upper roman I, II, III, ……
List Elements
You can specify a starting number for an ordered list.
</OL>
</OL>
List Elements
i. List item …
ii. List item …
Text ….
To add a favicon to your website, either save your favicon image to the root
directory of your webserver, or create a folder in the root directory
called images, and save your favicon image in this folder. A common
name for a favicon image is "favicon.ico".
Next, add a <link> element to your "index.html" file, after the <title> element,
like this:
<head>
<title>Welcome to Universal AI University</title>
<link rel="shortcut icon" href="favicon.png">
</head>
Images
Objectives
Edit a table.
1.Table Row<TR></TR>.
4.Caption <CAPTION></CAPTION>.
The table row elements usually contain table header elements or
table data elements.
Tables
<table border=“1”>
<tr>
<th> Column 1 header </th>
<th> Column 2 header </th>
</tr>
<tr>
<td> Row1, Col1 </td>
<td> Row1, Col2 </td>
</tr>
<tr>
<td> Row2, Col1 </td>
<td> Row2, Col2 </td>
</tr>
</table>
Tables
A table caption allows you to specify a line of text that will appear
centered above or bellow the table.
The Caption element has one attribute ALIGN that can be either
TOP (Above the table) or BOTTOM (below the table).
Table Header
<TR><TD bgcolor=red>3476-AB</TD><TD>76mm
Socket</TD><TD>45.00</TD></TR>
<TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR>
</TABLE>
Table Data and Table Header Attributes
</table>
Table Data and Table Header Attributes
Row 1 Col 1
Row 2 Col 2
Row 2 Col 1
Row 3 Col 2
Special Things to Note
• TH, TD and TR should always have end tags.
Although the end tags are formally optional, many browsers will
mess up the formatting of the table if you omit the end tags. In
particular, you should always use end tags if you have a TABLE
within a TABLE -- in this situation, the table parser gets hopelessly
confused if you don't close your TH, TD and TR elements.
• A default TABLE has no borders
By default, tables are drawn without border lines. You need the
BORDER attribute to draw the lines.
Special Things to Note
• By default, a table is flush with the left margin
TABLEs are plopped over on the left margin. If you want centered
tables, You can either: place the table inside a DIV element with
attribute ALIGN="center".
Most current browsers also supports table alignment, using the
ALIGN attribute. Allowed values are "left", "right", or "center", for
example: <TABLE ALIGN="left">. The values "left" and "right" float
the table to the left or right of the page, with text flow allowed around
the table. This is entirely equivalent to IMG alignment
What will be the output?
</TABLE>
The Output
Frames
Frames are a relatively new addition to the HTML standard.
First introduced in Netscape Navigator 2.0.
Objectives:
Doc1.html Doc2.html
Doc1.html Doc2.html
Frames.html
Frame Page Architecture
A <FRAMESET> element is placed in the html document before
the <BODY> element. The <FRAMESET> describes the amount
of screen real estate given to each windowpane by dividing the
screen into ROWS or COLS.
The <FRAMESET> will then contain <FRAME> elements, one
per division of the browser window.
Note: Because there is no BODY container, FRAMESET pages
can't have background images and background colors associated
with them.
Frame Page Architecture
<HTML>
<HEAD>
<FRAMeSET COLS=“23%,77%”>
<FRAME SRC=“Doc1.html”>
<FRAME SRC=“Doc2.html”>
</FRAMeSET >
</HEAD>
</HTML>
The Diagram below is a graphical view of
the document described above
FRAME FRAME
NAME= NAME=right_pane
left_pane SRC= Doc2.html
SRC=Doc1.h
tml
<FRAMESET> Container
<FRAMESET> : The FRAMESET element creates divisions in the browser
window in a single direction. This allows you to define divisions as either rows
or columns.
ROWS : Determines the size and number of rectangular rows within a
<FRAMESET>. They are set from top of the display area to the bottom.
Proportional values using the asterisk (*). This is often combined with a value
in pixels , e.g. “360,*”.
<Frameset cols=“200,20%,*,2*”>
Creating a Frames Page
COLS: Determines the size and number of
rectangular columns within a <FRAMESET>.
They are set from left to right of the display
area.
<HTML>
<HEAD>
<TITLE> Framed Page </TITLE>
</HEAD>
<NOFRAMES>
<FRAMESET COLS="23%,77%">
<FRAME SRC="" NAME="left_pane“>
<FRAME SRC="" NAME="right_pane">
<NOFRAMES>
<P> This is a Framed Page. Upgrade your
browser to support frames.</P>
</NOFRAMES></FRAMESET>
Compound FRAMESET Divisions
In this case a second FRAMESET element will
be inserted in the place of the FRAME element
that would describe the second row.
The second FRAMESET element will divide the
remaining screen real estate into 2 columns.
This nested FRAMESET will then be followed by
2 FRAME elements to describe each of the
subsequent frame divisions created.
Compound FRAMESET Divisions
<html> <noframes>
<head>
<p>
<title> Compound Frames Page</title>
Default
</head> message
<frameset rows=“120,*”>
<frame src=“banner_file.html” </p>
name”banner”> </noframes>
<frameset cols=“120,*”>
</frameset>
<frame src=“links_file.html”
name=“links”> </frameset>
<frame src=“content_file.html”
name=“content”> </head>
Compound FRAMESET Divisions
You may want to create a frames design with a
combination of rows and columns.
Banner File
Links
Contents File
File
Compound FRAMESET Divisions
Example
<HEAD>
<FRAMESET ROWS="25%,50%,25%”
<FRAME SRC="">
<FRAMESET COLS="25%,*">
<FRAME SRC="">
<FRAME SRC="">
</FRAMESET>
<FRAME SRC="">
</FRAMESET>
</HEAD>
Output
Frame Formatting
• Example:
<A HREF=“doc3.html”
TARGET=“right_pane”>Link to Document 3
</A>
Special Targets
• There are 4 special target names that cannot be assigned by
the NAME attribute of the FRAME tag.
1. TARGET=“_top” : This loads the linked document into the full
browser window with the URL specified by the HREF attribute.
All frames disappear, leaving the new linked page to occupy
the entire window. The back is turned on.
2. TARGET=“_blank” : Opens an unnamed new browser
window and loads the document specified in the URL attribute
into the new window (and your old window stays open). The
back is turned off. Other windows remains on.
chap2.html
Targeting links to frames
The TARGET attribute allows you to specify the frame into which a
page is to be loaded into in a frames setting.
chap3.html
Forms
Forms add the ability to web pages to not only provide the
person viewing the document with dynamic information but
also to obtain information from the person viewing it, and
process the information.
Objectives:
Upon completing this section, you should be able to
1. Create a FORM.
2. Add elements to a FORM.
JavaScripts.
TARGET: is the target frame where the response page will show up.
Form Elements
Form elements have properties: Text
boxes, Password boxes, Checkboxes,
Option(Radio) buttons, Submit, Reset,
File, Hidden and Image.
The properties are specified in the
TYPE Attribute of the HTML element
<INPUT></INPUT>.
Form Elements
<INPUT> Element’s Properties
TYPE= Type of INPUT entry field.
NAME = Variable name passed to CGI application
VALUE= The data associated with the variable
name to be passed to the CGI application
CHECKED= Button/box checked
SIZE= Number of visible characters in text field
MAXLENGHT= Maximum number of characters
accepted.
Text Box
Text boxes: Used to provide input fields for text, phone
numbers, dates, etc.
<INPUT TYPE= " TEXT " >
Browser will display
Textboxes use the following attributes:
TYPE: text.
SIZE: determines the size of the textbox in characters.
Default=20 characters.
MAXLENGHT : determines the maximum number of
characters that the field will accept.
NAME: is the name of the variable to be sent to the CGI
application.
VALUE: will display its contents as the default value.
Example on Text Box
<TITLE>Form_Text_Type</TITLE>
</HEAD> <BODY>
<h1> <font color=blue>Please enter the following bioData</font></h1>
<FORM name="fome1" Method= " get " Action= " URL " >
First Name: <INPUT TYPE="TEXT" NAME="FName"
SIZE="15" MAXLENGTH="25"><BR>
Last Name: <INPUT TYPE="TEXT" NAME="LName"
SIZE="15" MAXLENGTH="25"><BR>
Nationality: <INPUT TYPE="TEXT" NAME="Country"
SIZE="25" MAXLENGTH="25"><BR>
The Phone Number: <INPUT TYPE="TEXT" NAME="Phone"
SIZE="15" MAXLENGTH="12"><BR>
</FORM> </BODY> </HTML>
Password
Password: Used to allow entry of passwords.
<INPUT TYPE= " PASSWORD " >
Browser will display
Text typed in a password box is starred out in the browser
display.
Password boxes use the following attributes:
TYPE: password.
SIZE: determines the size of the textbox in characters.
MAXLENGHT: determines the maximum size of the password in
characters.
NAME: is the name of the variable to be sent to the CGI application.
VALUE: is usually blank.
Example on Password Box
<HTML><HEAD>
<TITLE>Form_Password_Type</TITLE></HEAD>
<BODY>
<h1> <font color=red>To Access, Please
enter:</font></h1>
<FORM>
<FONT Color=red>
<FONT Color=blue>
<FONT Color=green>
<FONT Color=yellow>
</FORM></DIV>
Submit Button
Submit: Every set of Form tags requires a Submit
button. This is the element causes the browser to
send the names and values of the other elements to
the CGI Application specified by the ACTION
attribute of the FORM element.
<INPUT TYPE=“SUBMIT”>
The browser will display
Submit has the following attributes:
TYPE: submit.
NAME: value used by the CGI script for processing.
VALUE: determines the text label on the button,
usually Submit Query.
<FORM Action="URL" method="get">
<BR>
<FONT Color=red>
</FORM>
Reset Button
• Reset: It is a good idea to include one of
these for each form where users are entering
data. It allows the surfer to clear all the input
in the form.
• <INPUT TYPE=“RESET”>
<form>
<H3><font color=forestgreen>
</form>
</BODY>
Other Elements used in Forms
<TEXTAREA></TEXTAREA>: is an element
that allows for free form text entry.
<BODY>
<FORM>
</SELECT>
</FORM></BODY></HTML>
<HEAD> <TITLE>SELECT with Mutiple </TITLE> </HEAD>
<BODY>
<FORM>
</SELECT>
</FORM></BODY></HTML>