Unit 1-HTML Final
Unit 1-HTML Final
HTML
Faculty Name:
Mr. Mingma Bhutia
1
Static Pages / Dynamic Pages
SERVER
HTML
style.css
SQL
etc
script.js
PRESENTATION
CSS
Imagery
STRUCTURE
HTML markup
Site planning
INTRODUCTION OF HTML
• HTML is a language for describing web pages.
• HTML stands for Hyper Text Markup Language
• HTML is not a programming language, it is
a markup language
• A markup language is a set of markup tags
• HTML uses markup tags to describe web pages
OBJECTIVES OF HTML
• Easy to use
• Loose syntax (although, being too flexible will not
comply with standards).
• Supported on almost every browser, if not all browsers.
• Widely used; established on almost every website, if
not all websites.
• Very similar to XML syntax, which is increasingly used
for data storage.
• Free - You need not buy any software.
• Easy to learn & code even for novice programmers.
DISADVANTAGES OF HTML
12
Creating a Basic Starting
Document
<HTML>
<HEAD>
<TITLE>Tecnia Institute </TITLE>
</HEAD>
<BODY>
This is what is displayed.
</BODY>
</HTML>
13
Color Codes
• Colors are set using “RGB” color codes,
which are, represented as hexadecimal
values. Each 2-digit section of the code
represents the amount, in sequence, of
red, green or blue that forms the color. For
example, a RGB value with 00 as the first
two digits has no red in the color.
14
Main Colours
15
RGB Colour Model
16
16 Basic Colors
17
Color Codes
1. WHITE 1. #FFFFFF
2. BLACK 2. #000000
3. RED 3. #FF0000
4. GREEN 4. #00FF00
5. BLUE 5. #0000FF
6. MAGENTA 6. #FF00FF
7. CYAN 7. #00FFFF
8. YELLOW 8. #FFFF00
9. AQUAMARINE 9. #70DB93
10. BAKER’S CHOCOLATE 10. #5C3317
11. VIOLET 11. #9F5F9F
12. BRASS 12. #B5A642
13. COPPER 13. #B87333
14. PINK 14. #FF6EC7
18
15. ORANGE 15. #FF7F00
The Body Element
• The BODY element of a web page is an important
element in regards to the page’s appearance. Here are
the attributes of the BODY tag to control all the levels:
19
Background Color
It is very common to see web pages with their
background color set to white or some other colors.
<BODY BGCOLOR=“#FFFFFF”></BODY>
20
TEXT Color
The TEXT attribute is used to control the color of all
the normal text in the document. The default color for
text is black. The TEXT attribute would be added as
follows:
<BODY BGCOLOR=“#FFFFFF”
TEXT=“#FF0000”></BODY>
21
LINK, VLINK, and ALINK
These attributes control the colors of the different link states:
<BODY BACKGROUND=“hi.gif”
BGCOLOR=“#FFFFFF”></BODY>
23
Headings, <Hx> </Hx>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY>
<H1> Heading 1 </H1>
Heading 1
<H2> Heading 2 </H2> Heading 2
<H3> Heading 3 </H3>
<H4> Heading 4 </H4> Heading 3
<H5> Heading 5 </H5> Heading 4
<H6> Heading 6 </H6> Heading 5
</BODY> Heading 6
</HTML>
24
Paragraphs, <P> </P>
<HTML><HEAD>
<TITLE> Example Page</TITLE> Heading 1
</HEAD> Paragraph 1,….
<BODY></H1> Heading 1 </H1>
<P> Paragraph 1, ….</P> Heading 2
<H2> Heading 2 </H2> Paragraph 2,….
<P> Paragraph 2, ….</P>
Heading 3
<H3> Heading 3 </H3>
Paragraph 3,….
<P> Paragraph 3, ….</P>
<H4> Heading 4 </H4> Heading 4
<P> Paragraph 4, ….</P> Paragraph 4,….
<H5> Heading 5 </H5> Heading 5
<P> Paragraph 5, ….</P> Paragraph 5,….
<H6> Heading 6</H6> Heading 6
<P> Paragraph 6, ….</P> Paragraph 6,….
</BODY></HTML>
25
Break, <BR>
Line breaks allow you to decide where the text
will break on a line or continue to the end of the
window.
A <BR> is an empty Element, meaning that it
may contain attributes but it does not contain
content.
The <BR> element does not have a closing tag.
26
Break, <BR>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY> Heading 1
<H1> Heading 1 </H1> Paragraph 1,….
<P>Paragraph 1, <BR>
Line 2 <BR> Line 3 <BR>…. Line 2
</P> Line 3
</BODY> ….
</HTML>
27
Horizontal Rule, <HR>
The <HR> element causes the
browser to display a horizontal
line (rule) in your document.
<HR> does not use a closing tag,
</HR>.
28
Horizontal Rule, <HR>
Attribute Description Default Value
Height of the rule in
SIZE 2 pixels
pixels
Width of the rule in
WIDTH pixels or percentage 100%
of screen width
Draw the rule with a Not set
NOSHADE flat look instead of a
3D look (3D look)
30
Character Formatting
How to enhance your page with Bold, Italics, and other
character formatting options.
31
Bold, Italic and other Character Formatting
Elements
<FONT SIZE=“+2”> Two sizes bigger</FONT>
The size attribute can be set as an absolute value from 1 to 7 or as a
relative value using the “+” or “-” sign. Normal text size is 3 (from -2 to +4).
<FONT COLOR=“#FF0000”>
Colored </FONT>
<BR>
<EM> Emphasized</EM> -
<STRONG> Strong </STRONG>
- <TT> Tele Type </TT> <BR>
33
Alignment
Some elements have attributes for
alignment (ALIGN) e.g. Headings,
Paragraphs and Horizontal Rules.
The Three alignment values are : LEFT,
RIGHT, CENTER.
<CENTER></CENTER> Will center
elements.
34
Alignment
37
List Elements
HTML supplies several list elements. Most list elements
are composed of one or more <LI> (List Item) elements.
UL : Unordered List. Items in this list start with a list mark
such as a bullet. Browsers will usually change the list
mark in nested lists.
<UL>
<LI> List item …</LI>
<LI> List item …</LI>
</UL>
• List item …
• List item …
38
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”>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
</UL>
List item …
List item …
List item …
39
List Elements
OL: Ordered List. Items in this list are numbered
automatically by the browser.
<OL type=“A”>
<LI> List item …</LI>
<LI> List item …</LI>
<LI> List item …</LI>
</OL>
A. List item …
B. List item …
C. List item
You have the choice of setting the TYPE Attribute to
one of five numbering styles.
40
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, ……
41
Images
42
Images
Width (WIDTH): is the width of the image in pixels.
44
HOW TO MAKE A LINK
1) The tags used to produce links are the <A> and </A>. The <A> tells
where the link should start and the </A> indicates where the link
ends.
Everything between these two will work as a link.
45
Internal Links
Internal Links : Links can also be created inside large documents to
simplify navigation. Today’s world wants to be able to get the
information quickly. Internal links can help you meet these goals.
1. Select some text at a place in the document that you would like to create
a link to, then add an anchor to link to like this:
<A NAME=“bookmark_name”></A>
46
Tables
The <TABLE></TABLE> element has four sub-
elements:
1. Table Row<TR></TR>.
2. Table Header <TH></TH>.
3. Table Data <TD></TD>.
4. Caption <CAPTION></CAPTION>.
49
Tables Attributes
BGColor: Some browsers support background colors in a table.
Border: You can choose a numerical value for the border width, which
specifies the border in pixels.
CellPadding: Cell Padding is the space between the cell border and
the cell contents and is specified in pixels.
Align: tables can have left, right, or center alignment.
50
Table Caption
A table caption allows you to specify a line of text that
will appear centered above or bellow the table.
51
Table Data and Table Header
Attributes
Colspan: Specifies how many cell columns of the table this cell
should span.
Rowspan: Specifies how many cell rows of the table this cell should
span.
Align: cell data can have left, right, or center alignment.
Valign: cell data can have top, middle, or bottom alignment.
Width: you can specify the width as an absolute number of pixels or
a percentage of the document width.
Height: You can specify the height as an absolute number of pixels
or a percentage of the document height.
52
What will be the output?
54
Frames
Frames are a relatively new addition to the HTML
standard. First introduced in Netscape
Navigator 2.0.
Objectives:
Upon completing this section, you should be able to:
Create a Frame based page.
Work with the Frameset, Frame, and Noframes
elements.
Use the attributes of the Frames elements to
control the display.
Set Targets appropriately.
55
Frames
Doc1.html Doc2.html
Doc1.html Doc2.html
Frames.html
57
Frame Page Architecture
58
Frame Page Architecture
<HTML>
<HEAD>
<TITLE> Framed Page </TITLE>
<FRAMeSET COLS=“23%,77%”>
<FRAME SRC=“Doc1.html”>
<FRAME SRC=“Doc2.html”>
</FRAMeSET >
</HEAD>
</HTML>
59
The Diagram below is a graphical view
of the document described above
NAME= NAME=right_pane
left_pane SRC= Doc2.html
SRC=Doc1.h
tml
60
<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.
62
Attributes of <Frameset> tag
FRAMEBORDER : Possible values 0, 1, YES, NO. A setting of
zero will create a borderless frame.
64
Attributes of <FRAME> tag
MARGINWIDTH: Optional attribute stated in pixels.
Determines horizontal space between the <FRAME> contents
and the frame’s borders.
67
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.
68
If a frame contains the following link, then clicking the link launches a new,
unnamed browser display window that contains the content defined in
stuff.HTM. This can be a simple HTML document, or an entirely new
FRAMESET definition.
chap2.html
70
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
71
Inline (or Floating) Frames
The latest version of browsers introduced a feature called
Floating Frames, which are identified by <iFrame> tag.
Eg:
</iframe>
72
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.
1. Create a FORM.
2. Add elements to a FORM.
3. Define CGI (Common Gateway Interface).
4. Describe the purpose of a CGI Application.
5. Specify an action for the FORM.
Forms work in all browsers.
Forms are Platform Independent.
73
Forms
To insert a form we use the <FORM></FORM> tags. The rest of the form
elements must be inserted in between the form tags.
<HTML> <HEAD>
<TITLE> Sample Form</TITLE>
</HEAD>
<BODY BGCOLOR=“FFFFFF”>
<FORM ACTION = http://www.xnu.com/formtest.asp>
<P> First Name: <INPUT TYPE=“TEXT” NAME=“fname” MAXLENGTH=“50”>
</P>
<P> <INPUT TYPE=“SUBMIT” NAME=“fsubmit1” VALUE=“Send Info”> </P>
</FORM>
</BODY> </HTML>
74
<FORM> element attributes
ACTION: is the URL of the CGI (Common Gateway Interface)
program that is going to accept the data from the form, process
it, and send a response back to the browser.
TARGET: is the target frame where the response page will show
up.
75
Form Elements
76
Sami Ali
Al al-Bayt University
77
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.
78
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.
<FORM name="fome1" Method= " get " Action= " URL " >
First Name: <INPUT TYPE="TEXT" NAME="FName"
SIZE="15" MAXLENGTH="25"><BR>
81
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.
82
Example on Password Box
<HTML>
<HEAD>
<TITLE>Form_Password_Type</TITLE></HEAD>
<BODY>
<h1> <font color=red>To Access, Please enter:</font></h1>
</FORM>
</BODY>
</HTML>
83
Output
84
Hidden
Hidden: Used to send data to the CGI application that you don’t
want the web surfer to see, change or have to enter but is
necessary for the application to process the form correctly.
<INPUT TYPE=“HIDDEN”>
Nothing is displayed in the browser.
85
Check Box
Check Box: Check boxes allow the users to select more than
one option.
<INPUT TYPE=“CHECKBOX”>
Browser will display
86
<HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD>
<BODY>
<h1>
<font color=green>Please check one of the following</font>
</h1>
</FORM>
</BODY>
</HTML>
87
Output
88
Radio Button
Radio Button: Radio buttons allow the users to select
only one option.
<INPUT TYPE=“RADIO”>
Browser will display
89
<HTML>
<HEAD><TITLE>CheckBoxType</TITLE> </HEAD>
<BODY>
<h1> <font color=green>Please check one of the following</font></h1>
Form #2:
<FORM>
<INPUT TYPE="radio" NAME="choice" VALUE="three" CHECKED> Yes.
<INPUT TYPE="radio" NAME="choice" VALUE="four"> No.
</FORM>
</BODY
92
Output
93
Push Button
Push Button: This element would be used with
JavaScript to cause an action to take place.
<INPUT TYPE=“BUTTON”>
Browser will display
94
<DIV align=center><BR><BR>
<FORM>
<FONT Color=red>
Press Here to see a baby crying:<BR>
<INPUT TYPE="button" VALUE="PressMe"><BR><BR>
<FONT Color=blue>
Click Here to see a baby shouting:<BR>
<INPUT TYPE="button" VALUE="ClickMe" > <BR><BR>
<FONT Color=green>
Hit Here to see a baby eating:<BR>
<INPUT TYPE="button" VALUE="HitME" > <BR><BR>
</FORM>
</DIV>
95
96
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.
97
<FORM Action="URL" method="get">
<BR>
<FONT Color=red>
Press Here to submit the data:<BR>
</FORM>
98
99
Reset Button
• <INPUT TYPE=“RESET”>
100
<FORM Action="URL" method="get">
</FORM>
101
102
File
• File Upload: You can use a file upload to allow surfers to
upload files to your web server.
• <INPUT TYPE=“FILE”>
• Browser will display
<TEXTAREA></TEXTAREA>: is an element
that allows for free form text entry.
</TEXTAREA>:
</form>
</BODY>
106
107
Other Elements used in Forms
The two following examples are
<SELECT></SELECT> elements, where the
attributes are set differently.
108
Other Elements used in Forms
Option
The list items are added to the <SELECT> element by
inserting <OPTION></OPTION> elements.
112
113
<HEAD>
<TITLE>SELECT with Mutiple </TITLE> </HEAD>
<BODY>
<h2>
<font color=blue>What type of Computer do you have?</font><h2>
<FORM>
</FORM>
</BODY>
</HTML>
114
115
REVISING – FORM ELEMENTS
116
MARQUEE TAG
• This tag is used text horizontally across
the screen.it is mainly used to deliver a
specfic message to the visitor or to scroll
Ads on a page.
• Example: <marquee> hello
world></marquee>
Attributes of marquee tag
<map name="workmap">
</map>
123
Inserting Video in Web pages
The HTML <video> element is used to show a video
on a web page.
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>
126