SlideShare a Scribd company logo
1
Introduction to
HTML
 H T M L I S T H E C O R E T E C H N O L O G Y I N W H I C H A L L W E B P A G E S
A R E W R I T T E N .
 H T M L I S A L A N G U A G E F O R D E S C R I B I N G W E B P A G E S .
 H T M L S T A N D S F O R H Y P E R T E X T M A R K U P L A N G U A G E .
 H T M L I S N O T A P R O G R A M M I N G L A N G U A G E , I T I S A M A R K U P
L A N G U A G E .
 A M A R K U P L A N G U A G E I S A C O L L E C T I O N O F M A R K U P T A G S .
 H T M L U S E S M A R K U P T A G S T O D E S C R I B E W E B P A G E S .
What is HTML?
HTML.ppt
A small HTML document
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
 The DOCTYPE declaration defines the document type
to be HTML
 The text between <html> and </html> describes an
HTML document
 The text between <head> and </head> provides
information about the document
 The text between <title> and </title> provides a title
for the document
 The text between <body> and </body> describes the
visible page content
 The text between <h1> and </h1> describes a heading
 The text between <p> and </p> describes a paragraph
HTML Tags
 HTML tags are keywords (tag names) surrounded
by angle brackets:
 <tagname>content</tagname>
 HTML tags normally come in pairs like <p> and
</p>
 The first tag in a pair is the start tag, the second tag
is the end tag
 Tags are not case sensitive
 The end tag is written like the start tag, but with
a slash before the tag name
The start tag is often called the opening tag. The end tag is often called
the closing tag.
Web Browsers
 The purpose of a web browser (Chrome, IE, Firefox,
Safari) is to read HTML documents and display them.
 The browser does not display the HTML tags, but uses
them to determine how to display the document:
HTML Page Structure
The <!DOCTYPE> Declaration
 The <!DOCTYPE> declaration helps the browser to display a
web page correctly.
 There are different document types on the web.
 To display a document correctly, the browser must know both
type and version.
 The doctype declaration is not case sensitive. All cases are
acceptable:
 <!DOCTYPE html>
<!DOCTYPE HTML>
<!doctype html>
<!Doctype Html>
HTML Versions
Version Year
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML5 2014
Open Notepad (PC)
 Open Notepad in Windows 8 or later:
 Open the Start Screen (the window symbol at the
bottom left on your screen). Type Notepad.
 Open Notepad in Windows 7 or earlier:
 Click Start (bottom left on your screen). Click All
Programs. Click Accessories. Click Notepad.
Write Some HTML
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Save the HTML Page
 Save the file on your computer.
 Select File > Save as in the Notepad menu.
 Name the file "index.html" or any other name
ending with html or htm.
 UTF-8 is the preferred encoding for HTML files.
 ANSI encoding covers US and Western European
characters only.
View HTML Page in Your Browser
HTML Documents
 All HTML documents must start with a type
declaration: <!DOCTYPE html>.
 The HTML document itself begins with <html> and
ends with </html>.
 The visible part of the HTML document is
between <body> and </body>.
HTML Elements
 HTML elements are written with a start tag, with
an end tag, with the content in between:
 <tagname>content</tagname>
 The HTML element is everything from the start tag
to the end tag:
 <p>My first HTML paragraph.</p>
Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>
<br>
HTML Headings
<h1>This is a Heading 1</h1>
<h2>This is a Heading 2</h2>
<h3>This is a Heading 3</h3>
<h4>This is a Heading 4</h4>
<h5>This is a Heading 5</h5>
<h6>This is a Heading 6</h6>
HTML Rules (Lines) <hr/>
 <html>
 <body>
 <p>The hr tag defines a horizontal rule:</p>
 <hr />
 <p>This is a paragraph</p>
 <hr />
 <p>This is a paragraph</p>
 <hr />
 <p>This is a paragraph</p>
 </body>
 </html>
HTML.ppt
HTML Attributes
 HTML elements can have attributes
 Attributes provide additional information about
an element
 Attributes are always specified in the start tag
 Attributes come in name/value pairs
like: name="value"
The href Attribute
 HTML links are defined with the <a> tag. The link address is
specified in the href attribute:
<a href="http://CTC.com">This is a link</a>
Size Attributes
<img src="w3schools.jpg" width="104" height="142">
The alt Attribute
<img src="w3schools.jpg" alt="W3Schools.com" wid
th="104" height="142">
Single or Double Quotes?
<p title='John "ShotGun" Nelson'>
<p title="John 'ShotGun' Nelson">
HTML Attributes
HTML Tag Reference
Tag Description
<html> Defines an HTML document
<body> Defines the document's body
<head> Defines the document's head element
<h1> to <h6> Defines HTML headings
<hr> Defines a horizontal line
HTML Background Color
<body style="background-color:lightgrey;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
HTML Text Color
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
HTML Fonts
<h1 style="font-family:verdana;">This is a
heading</h1>
<p style="font-family:courier;">This is a
paragraph.</p>
HTML Text Size
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a
paragraph.</p>
HTML Text Alignment
<h1 style="text-align:center;">Centered
Heading</h1>
<p>This is a paragraph.</p>
HTML Text Formatting Elements
Tag Description
<b> Defines bold text
<em> Defines emphasized text
<i> Defines italic text
<small> Defines smaller text
<strong> Defines important text
<sub> Defines subscripted text
<sup> Defines superscripted text
<ins> Defines inserted text
<del> Defines deleted text
<mark> Defines marked/highlighted text
27
Setting Document Properties
 Document properties are controlled
by attributes of the BODY element.
 For example, there are color settings
for the background color of the page,
the document’s text and different
states of links.
31
16 Basic Colors
32
Color Codes
1. WHITE
2. BLACK
3. RED
4. GREEN
5. BLUE
6. MAGENTA
7. CYAN
8. YELLOW
9. AQUAMARINE
10. BAKER’S CHOCOLATE
11. VIOLET
12. BRASS
13. COPPER
14. PINK
15. ORANGE
1. #FFFFFF
2. #000000
3. #FF0000
4. #00FF00
5. #0000FF
6. #FF00FF
7. #00FFFF
8. #FFFF00
9. #70DB93
10. #5C3317
11. #9F5F9F
12. #B5A642
13. #B87333
14. #FF6EC7
15. #FF7F00
33
Background Color
 To set your document’s background color,
you need to edit the <BODY> element by
adding the BGCOLOR attribute. The
following example will display a document
with a white background color:
<BODY BGCOLOR=“#FFFFFF”></BODY>
34
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>
35
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:
<BODY BACKGROUND=“hi.gif”
BGCOLOR=“#FFFFFF”></BODY>
36
Previewing Your Work
 Once you have created your basic starting
document and set your document properties it
is a good idea to save your file.
 To save a file, in NotePad, follow these steps:
1. Locate and click on the menu called “File”.
2. Select the option under File Menu labeled
“Save As”.
3. In the “File Name” text box, type in the entire
name of your file (including the extension
name .html).
37
Headings, <Hx> </Hx>
1. H1: should be used as the highest level of heading, H2
as the next highest, and so forth.
2. Examples <H1>He is a web designer</H1>
1. <H2>He is a web designer</H2>
2. <H3>He is a web designer</H3>
3. <H4>He is a web designer</H4>
4. <H5>He is a web designer</H5>
5. <H6>He is a web designer</H6>
38
Headings, <Hx> </Hx>
<HTML>
<HEAD>
<TITLE> Example Page</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>
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
39
Paragraphs, <P> </P>
 Paragraphs allow you to add text to a
document in such a way that it will
automatically adjust the end of line to suite
the window size of the browser in which it
is being displayed. Each line of text will
stretch the entire length of the window.
40
Paragraphs, <P> </P>
<HTML><HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY></H1> Heading 1 </H1>
<P> Paragraph 1, ….</P>
<H2> Heading 2 </H2>
<P> Paragraph 2, ….</P>
<H3> Heading 3 </H3>
<P> Paragraph 3, ….</P>
<H4> Heading 4 </H4>
<P> Paragraph 4, ….</P>
<H5> Heading 5 </H5>
<P> Paragraph 5, ….</P>
<H6> Heading 6</H6>
<P> Paragraph 6, ….</P>
</BODY></HTML>
Heading 1
Paragraph 1,….
Heading 2
Paragraph 2,….
Heading 3
Paragraph 3,….
Heading 4
Paragraph 4,….
Heading 5
Paragraph 5,….
Heading 6
Paragraph 6,….
41
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.
42
Break, <BR>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY>
<H1> Heading 1 </H1>
<P>Paragraph 1, <BR>
Line 2 <BR> Line 3 <BR>….
</P>
</BODY>
</HTML>
Heading 1
Paragraph 1,….
Line 2
Line 3
….
43
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>.
44
Horizontal Rule, <HR>
Attribute Description Default Value
SIZE
Height of the rule in
pixels
2 pixels
WIDTH
Width of the rule in
pixels or percentage
of screen width
100%
ALIGN
Aligns the line (Left,
Center, Right)
Center
COLOR
Sets a color for the
rule (IE 3.0 or later)
Not set
45
Horizontal Rule, <HR>
<HTML>
<HEAD>
<TITLE> Example Page</TITLE>
</HEAD>
<BODY>
<H1> Heading 1 </H1>
<P>Paragraph 1, <BR>
Line 2 <BR>
<HR>Line 3 <BR>
</P>
</BODY>
</HTML>
Heading 1
Paragraph 1,….
Line 2
______________________
_____
Line 3
46
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).
 <B> Bold </B>
 <I> Italic </I>
 <U> Underline </U>
 Color = “#RRGGBB” The COLOR attribute of the FONT
element. E.g., <FONT COLOR=“#RRGGBB”>this text
has color</FONT>
47
Bold, Italic and other Character Formatting
Elements
CODING
<P> <FONT SIZE=“+1”> One
Size Larger </FONT> - Normal
–
<FONT SIZE=“-1”> One Size
Smaller </FONT> <BR>
<B> Bold</B> - <I> italics</I> -
<U> Underlined </U> -
<FONT COLOR=“#FF0000”>
Colored </FONT> <BR>
<I> Emphasized</I> -
<STRONG> Strong
</STRONG>
output
One Size Larger - Normal – One
Size Smaller
Bold - italics - Underlined -
Colored
Emphasized -
48
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.
49
Alignment
 <DIV ALIGN=“value”></DIV> Represents
a division in the document and can contain
most other element type. The alignment
attribute of the DIV element is well
supported.
50
Special Characters & Symbols
Special
Character
Entity
Name
Special
Character
Entity
Name
Ampersand &amp; & Greater-than
sign
&gt; >
Asterisk &lowast;
∗∗
Less-than sign &lt; <
Cent sign &cent; ¢ Non-breaking
space
&nbsp;
Copyright &copy; © Quotation mark &quot; "
Fraction one
qtr
&frac14;
¼
Registration
mark
&reg; ®
Fraction one
half
&frac12;
½
Trademark sign &trade;
™
51
Additional Character Formatting Elements
 <STRIKE> strike-through text</STRIKE>
DEL is used for STRIKE at the latest
browsers
 <BIG> places text in a big font</BIG>
 <SMALL> places text in a small
font</SMALL>
 <SUB> places text in subscript position </SUB>
 <SUP> places text in superscript style
position </SUP>
52
Example
<P><STRIKE> strike-through
text </STRIKE></BR>
<BIG>places text in a big font
</BIG><BR>
<SMALL> places text in a
small font</SMALL><BR>
<SUB> places text in subscript
position </SUB>Normal
<SUP> places text in
superscript style position
</SUP><BR> </P>
53
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 …
54
Images
In this chapter you will learn about images
and how to place images in your pages.
Objectives
Upon completing this section, you should be
able to
1. Add images to your pages.
55
Images
 <IMG>This element defines a graphic image on
the page.
 EX:- <IMG SRC=“boy.gif“ border=4>
HTML TAG Name of Pic.
56
Images
 Width (WIDTH): is the width of the image in pixels.
 Height (HEIGHT): is the height of the image in
pixels.
 Border (BORDER): is for a border around the
image, specified in pixels.
 HSPACE: is for Horizontal Space on both sides of
the image specified in pixels. A setting of 5 will put 5
pixels of invisible space on both sides of the image.
 VSPACE: is for Vertical Space on top and bottom of
the image specified in pixels. A setting of 5 will put 5
pixels of invisible space above and bellow the
image.
57
Some Examples on images
1) <IMG SRC=“boy.gif“ border=4>
2) <IMG SRC=" boy.gif" width="60"
height="60">
3) <IMG SRC=" boy.gif “ Hspace="30"
Vspace="10" border=20>
4) < IMG SRC =" jordan.gif“ align="left">
blast blast blast blast blast
58
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.
2) The example below shows how to make the word
Here work as a link to yahoo.
Click <A HREF="http://www.yahoo.com">yahoo</A> to
go to yahoo.
59
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>
The Name attribute of an anchor element specifies a location
in the document that we link to shortly. All NAME attributes in
a document must be unique.
2. Next select the text that you would like to create as a link to
the location created above.
<A HREF=“#bookmark_name”>Go To Book Mark</A>
60
Tables
In this chapter you will learn that tables have many uses in
HTML.
Objectives:
Upon completing this section, you should be able to:
1. Insert a table.
2. Explain a table’s attributes.
3. Edit a table.
4. Add a table header.
61
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>.
 The table row elements usually contain table
header elements or table data elements.
62
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>
63
Tables
Column 1 Header Column 2 Header
Row1, Col1 Row1, Col2
Row2, Col1 Row2, Col2
64
Tables Attributes
 BGColor: Some browsers support background
colors in a table.
 Width: you can specify the table width as an
absolute number of pixels or a percentage of the
document width. You can set the width for the
table cells as well.
 Border: You can choose a numerical value for
the border width, which specifies the border in
pixels.
 CellSpacing: Cell Spacing represents the space
between cells and is specified in pixels.
65
Table Attributes
 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.
 BorderColor, BorderColorDark.
66
Table Caption
 A table caption allows you to specify a line of
text that will appear centered above or bellow
the table.
<TABLE BORDER=1 CELLPADDING=2>
<CAPTION ALIGN=“BOTTOM”> Label For My Table
</CAPTION>
 The Caption element has one attribute ALIGN
that can be either TOP (Above the table) or
BOTTOM (below the table).
67
Table Header
 Table Data cells are represented by the
TD element. Cells can also be TH (Table
Header) elements which results in the
contents of the table header cells
appearing centered and in bold text.
68
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.
69
<TABLE BORDER=1 width=50%>
<CAPTION> <h1>Spare Parts <h1> </Caption>
<TR><TH>Stock Number</TH><TH>Description</TH><TH>List
Price</TH></TR>
<TR><TD bgcolor=red>3476-AB</TD><TD>76mm
Socket</TD><TD>45.00</TD></TR>
<TR><TD >3478-AB</TD><TD><font color=blue>78mm Socket</font>
</TD><TD>47.50</TD></TR>
<TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR>
</TABLE>
Basic Table Code
70
<TABLE BORDER width=“750”>
<TR> <TD colspan=“4” align=“center”>Page
Banner</TD></TR>
<TR> <TD rowspan=“2” width=“25%”>Nav
Links</TD><TD colspan=“2”>Feature
Article</TD> <TD rowspan=“2”
width=“25%”>Linked Ads</TD></TR>
<TR><TD width=“25%”>News Column 1 </TD>
<TD width=“25%”><News Column 2 </TD></TR>
</TABLE>
What will be the output?
71
The Output
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.
Objectives:
Upon completing this section, you should be able to
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
Sami Ali
Al al-Bayt University
EXAMPLE Forms
74
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=“” VALUE=“Send Info”> </P>
</FORM>
</BODY> </HTML>
75
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>.
76
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.
77
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.
78
<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>
Example on Text Box
79
Output
80
 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.
Password
81
<HTML><HEAD>
<TITLE>Form_Password_Type</TITLE></HEAD>
<BODY>
<h1> <font color=red>To Access, Please
enter:</font></h1>
<FORM name="fome2" Action="url" >
User Name: <INPUT TYPE="TEXT" Name="FName"
SIZE="15" MAXLENGTH="25"><BR>
Password: <INPUT TYPE="PASSWORD"
NAME="PWord" value="" SIZE="15”
MAXLENGTH="25"><BR>
</FORM></BODY> </HTML>
Example on Password Box
82
Output
83
 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.
Hidden inputs have the following attributes:
 TYPE: hidden.
 NAME: is the name of the variable to be sent to
the CGI application.
 VALUE: is usually set a value expected by the
CGI application.
Hidden
84
Check Box
 Check Box: Check boxes allow the users to select
more than one option.
<INPUT TYPE=“CHECKBOX”>
Browser will display
Checkboxes have the following attributes:
 TYPE: checkbox.
 CHECKED: is blank or CHECKED as the initial
status.
 NAME: is the name of the variable to be sent to the
CGI application.
 VALUE: is usually set to a value.
85
<HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD>
<BODY>
<h1> <font color=green>Please check one of the
following</font></h1>
<FORM name="fome3" Action="url" method="get">
<font color=red> Select Country: </font><BR>
jordan:<INPUT TYPE="CheckBox" Name="country"
CHECKED><BR>
Yemen<INPUT TYPE="CheckBox" Name="country"><BR>
Qatar:<INPUT TYPE="CheckBox" Name="country"><BR>
<BR>
<font color=blue>Select Language:</font><BR>
Arabic:<INPUT TYPE="CheckBox" Name="language"
CHECKED><BR> English:<INPUT TYPE="CheckBox"
Name="language"><BR>
French:<INPUT TYPE="CheckBox" Name="language">
<BR></FORM> </BODY></HTML>
86
Output
87
 Radio Button: Radio buttons allow the users to select
only one option.
<INPUT TYPE=“RADIO”>
Browser will display
Radio buttons have the following attributes:
 TYPE: radio.
 CHECKED: is blank or CHECKED as the initial
status. Only one radio button can be
checked
 NAME: is the name of the variable to be sent to the
CGI application.
 VALUE: usually has a set value.
Radio Button
88
<HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD>
<BODY>
<h1> <font color=green>Please check one of the
following</font></h1>
<FORM name="fome3" Action="url" method="get">
<font color=red> Select Country: </font><BR>
jordan:<INPUT TYPE= "RADIO" Name="country"
CHECKED><BR>
Yemen<INPUT TYPE="RADIO " Name="country"><BR>
Qatar:<INPUT TYPE="RADIO" Name="country"><BR>
<BR>
<font color=blue>Select Language:</font><BR>
Arabic:<INPUT TYPE="RADIO" Name="language"
CHECKED><BR> English:<INPUT TYPE=" RADIO "
Name="language"><BR>
French:<INPUT TYPE=" RADIO " Name="language">
<BR></FORM> </BODY></HTML>
89
90
 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.
Submit Button
91
<FORM Action="URL" method="get">
First Name: <INPUT TYPE="TEXT" Size=25
name="firstName"><BR>
Family Name: <INPUT TYPE="TEXT" Size=25
name="LastName"><BR>
<BR>
<FONT Color=red>
Press Here to submit the data:<BR>
<INPUT TYPE="submit" VALUE="SubmitData " >
</FORM>
92
93
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”>
• Browser will display
•
• Reset buttons have the following attributes:
• TYPE: reset.
• VALUE: determines the text label on the
button, usually Reset.
94
95
• File Upload: You can use a file upload to allow surfers to
upload files to your web server.
• <INPUT TYPE=“FILE”>
• Browser will display
• File Upload has the following attributes:
• TYPE: file.
• SIZE: is the size of the text box in characters.
• NAME: is the name of the variable to be sent to the
CGI application.
• MAXLENGHT: is the maximum size of the input in the
textbox in characters.
File
96
Other Elements used in Forms
 <TEXTAREA></TEXTAREA>: is an element
that allows for free form text entry.
Browser will display
Textarea has the following attributes:
 NAME: is the name of the variable to be sent
to the CGI application.
 ROWS: the number of rows to the textbox.
 COLS: the number of columns to the textbox.
97
Other Elements used in Forms
 The two following examples are
<SELECT></SELECT> elements, where the
attributes are set differently..
Select the cities you have visited:
<SELECT name=“list” size=5>
<option> London</option>
<option> Tokyo</option>
<option> Paris</option>
<option> New York</option>
<option> LA</option>
<option> KL</option>
</SELECT>
98
99
<HEAD> <TITLE>SELECT with Mutiple </TITLE>
</HEAD>
<BODY>
<h2><font color=blue>What type of Computer do you
have?</font><h2>
<FORM>
<SELECT NAME="ComputerType" size=5 multiple>
<OPTION value="IBM" > IBM</OPTION>
<OPTION value="INTEL"> INTEL</OPTION>
<OPTION value=" Apple"> Apple</OPTION>
<OPTION value="Compaq" SELECTED>
Compaq</OPTION>
<OPTION value=" other"> Other</OPTION>
</SELECT>
</FORM></BODY></HTML>
100
101
Assignment Forms for U
102
Any Doubts?
103
HTML completed

More Related Content

PPTX
How to learn HTML in 10 Days
Manoj kumar Deswal
 
PPTX
WEB TECHNOLOGY SLIDE 2 coe35mgfdggdh.pptx
simukondasankananji8
 
PPSX
Html introduction
Dalia Elbadry
 
PPT
html
tumetr1
 
PPTX
Html 1
pavishkumarsingh
 
PPTX
html (1) (1).pptx for all students to learn
aveshgopalJonnadula
 
PPTX
html.pptx class notes to prepare html completly
mamathapragada
 
PPT
Web Design-III IT.ppt
banu236831
 
How to learn HTML in 10 Days
Manoj kumar Deswal
 
WEB TECHNOLOGY SLIDE 2 coe35mgfdggdh.pptx
simukondasankananji8
 
Html introduction
Dalia Elbadry
 
html
tumetr1
 
html (1) (1).pptx for all students to learn
aveshgopalJonnadula
 
html.pptx class notes to prepare html completly
mamathapragada
 
Web Design-III IT.ppt
banu236831
 

Similar to HTML.ppt (20)

PPTX
HTML and DHTML
Dr. SURBHI SAROHA
 
PPT
Unit 2 (html)
manochitra10
 
PPT
HTML5 with PHP.ini
Abhinav Bhatnagar
 
PPT
Web Design.ppt
Dr.R.SUGANYA RENGARAJ
 
PPT
Html ppt by Fathima faculty Hasanath college for women bangalore
fathima12
 
PPTX
HTML Introduction
Hameda Hurmat
 
DOCX
Lesson A.1 - Introduction to Web Development.docx
MarlonMagtibay3
 
PPTX
Week-1_PPT_WEBAPPS-done.pptx
JuvyIlustrisimo
 
PPTX
htmlbcjdkkdkcjcjcjfkjccjckcjcjc_doc1.pptx
DSAISUBRAHMANYAAASHR
 
PPTX
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
johnmngoya1
 
PDF
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Erin M. Kidwell
 
PPTX
Basic Html Knowledge for students
vethics
 
PDF
"Innovative Web Design & Development Hub
kyereernest560
 
PPTX
presentation_html_ppt_1.pptx
IrfanRashid36
 
PPTX
EBRE TABOR UNIVERSITY Gafat Institute of Technology Department of Information...
shambelworku8
 
PPTX
html -Hyper Text Markup Languagejjjjjjjjjjjjjjjjjjjjjjjjj
NetajiGandi1
 
PDF
2a web technology html basics 1
Jyoti Yadav
 
PPT
HTML
SanthiNivas
 
PPTX
Html and Css Student Education hub point.pptx
AbenezerTefera2
 
HTML and DHTML
Dr. SURBHI SAROHA
 
Unit 2 (html)
manochitra10
 
HTML5 with PHP.ini
Abhinav Bhatnagar
 
Web Design.ppt
Dr.R.SUGANYA RENGARAJ
 
Html ppt by Fathima faculty Hasanath college for women bangalore
fathima12
 
HTML Introduction
Hameda Hurmat
 
Lesson A.1 - Introduction to Web Development.docx
MarlonMagtibay3
 
Week-1_PPT_WEBAPPS-done.pptx
JuvyIlustrisimo
 
htmlbcjdkkdkcjcjcjfkjccjckcjcjc_doc1.pptx
DSAISUBRAHMANYAAASHR
 
WEBSITE DEVELOPMENT,HTML is the standard markup language for creating Web pag...
johnmngoya1
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Erin M. Kidwell
 
Basic Html Knowledge for students
vethics
 
"Innovative Web Design & Development Hub
kyereernest560
 
presentation_html_ppt_1.pptx
IrfanRashid36
 
EBRE TABOR UNIVERSITY Gafat Institute of Technology Department of Information...
shambelworku8
 
html -Hyper Text Markup Languagejjjjjjjjjjjjjjjjjjjjjjjjj
NetajiGandi1
 
2a web technology html basics 1
Jyoti Yadav
 
Html and Css Student Education hub point.pptx
AbenezerTefera2
 
Ad

More from BISWARANJANSAHOO78 (8)

PPTX
domestic violence IN INDIA A REPORT.pptx
BISWARANJANSAHOO78
 
PPTX
PPT_on_Domestic_Violence_in_India.pptx
BISWARANJANSAHOO78
 
PPT
Violence Against Women.ppt
BISWARANJANSAHOO78
 
PPTX
MSWORD.pptx
BISWARANJANSAHOO78
 
PPTX
genderstereotyp.pptx
BISWARANJANSAHOO78
 
PPTX
CYCLONE in india.pptx
BISWARANJANSAHOO78
 
PDF
plastic awareness.pdf
BISWARANJANSAHOO78
 
PPTX
CPR - VALUE ADDED PROG ENGG.pptx
BISWARANJANSAHOO78
 
domestic violence IN INDIA A REPORT.pptx
BISWARANJANSAHOO78
 
PPT_on_Domestic_Violence_in_India.pptx
BISWARANJANSAHOO78
 
Violence Against Women.ppt
BISWARANJANSAHOO78
 
MSWORD.pptx
BISWARANJANSAHOO78
 
genderstereotyp.pptx
BISWARANJANSAHOO78
 
CYCLONE in india.pptx
BISWARANJANSAHOO78
 
plastic awareness.pdf
BISWARANJANSAHOO78
 
CPR - VALUE ADDED PROG ENGG.pptx
BISWARANJANSAHOO78
 
Ad

Recently uploaded (20)

PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PoojaSen20
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 

HTML.ppt

  • 2.  H T M L I S T H E C O R E T E C H N O L O G Y I N W H I C H A L L W E B P A G E S A R E W R I T T E N .  H T M L I S A L A N G U A G E F O R D E S C R I B I N G W E B P A G E S .  H T M L S T A N D S F O R H Y P E R T E X T M A R K U P L A N G U A G E .  H T M L I S N O T A P R O G R A M M I N G L A N G U A G E , I T I S A M A R K U P L A N G U A G E .  A M A R K U P L A N G U A G E I S A C O L L E C T I O N O F M A R K U P T A G S .  H T M L U S E S M A R K U P T A G S T O D E S C R I B E W E B P A G E S . What is HTML?
  • 4. A small HTML document <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
  • 5. Example Explained  The DOCTYPE declaration defines the document type to be HTML  The text between <html> and </html> describes an HTML document  The text between <head> and </head> provides information about the document  The text between <title> and </title> provides a title for the document  The text between <body> and </body> describes the visible page content  The text between <h1> and </h1> describes a heading  The text between <p> and </p> describes a paragraph
  • 6. HTML Tags  HTML tags are keywords (tag names) surrounded by angle brackets:  <tagname>content</tagname>  HTML tags normally come in pairs like <p> and </p>  The first tag in a pair is the start tag, the second tag is the end tag  Tags are not case sensitive  The end tag is written like the start tag, but with a slash before the tag name The start tag is often called the opening tag. The end tag is often called the closing tag.
  • 7. Web Browsers  The purpose of a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them.  The browser does not display the HTML tags, but uses them to determine how to display the document:
  • 9. The <!DOCTYPE> Declaration  The <!DOCTYPE> declaration helps the browser to display a web page correctly.  There are different document types on the web.  To display a document correctly, the browser must know both type and version.  The doctype declaration is not case sensitive. All cases are acceptable:  <!DOCTYPE html> <!DOCTYPE HTML> <!doctype html> <!Doctype Html>
  • 10. HTML Versions Version Year HTML 1991 HTML 2.0 1995 HTML 3.2 1997 HTML 4.01 1999 XHTML 2000 HTML5 2014
  • 11. Open Notepad (PC)  Open Notepad in Windows 8 or later:  Open the Start Screen (the window symbol at the bottom left on your screen). Type Notepad.  Open Notepad in Windows 7 or earlier:  Click Start (bottom left on your screen). Click All Programs. Click Accessories. Click Notepad.
  • 12. Write Some HTML <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>
  • 13. Save the HTML Page  Save the file on your computer.  Select File > Save as in the Notepad menu.  Name the file "index.html" or any other name ending with html or htm.  UTF-8 is the preferred encoding for HTML files.  ANSI encoding covers US and Western European characters only.
  • 14. View HTML Page in Your Browser
  • 15. HTML Documents  All HTML documents must start with a type declaration: <!DOCTYPE html>.  The HTML document itself begins with <html> and ends with </html>.  The visible part of the HTML document is between <body> and </body>.
  • 16. HTML Elements  HTML elements are written with a start tag, with an end tag, with the content in between:  <tagname>content</tagname>  The HTML element is everything from the start tag to the end tag:  <p>My first HTML paragraph.</p> Start tag Element content End tag <h1> My First Heading </h1> <p> My first paragraph. </p> <br>
  • 17. HTML Headings <h1>This is a Heading 1</h1> <h2>This is a Heading 2</h2> <h3>This is a Heading 3</h3> <h4>This is a Heading 4</h4> <h5>This is a Heading 5</h5> <h6>This is a Heading 6</h6>
  • 18. HTML Rules (Lines) <hr/>  <html>  <body>  <p>The hr tag defines a horizontal rule:</p>  <hr />  <p>This is a paragraph</p>  <hr />  <p>This is a paragraph</p>  <hr />  <p>This is a paragraph</p>  </body>  </html>
  • 20. HTML Attributes  HTML elements can have attributes  Attributes provide additional information about an element  Attributes are always specified in the start tag  Attributes come in name/value pairs like: name="value"
  • 21. The href Attribute  HTML links are defined with the <a> tag. The link address is specified in the href attribute: <a href="http://CTC.com">This is a link</a> Size Attributes <img src="w3schools.jpg" width="104" height="142"> The alt Attribute <img src="w3schools.jpg" alt="W3Schools.com" wid th="104" height="142"> Single or Double Quotes? <p title='John "ShotGun" Nelson'> <p title="John 'ShotGun' Nelson">
  • 23. HTML Tag Reference Tag Description <html> Defines an HTML document <body> Defines the document's body <head> Defines the document's head element <h1> to <h6> Defines HTML headings <hr> Defines a horizontal line
  • 24. HTML Background Color <body style="background-color:lightgrey;"> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> HTML Text Color <h1 style="color:blue;">This is a heading</h1> <p style="color:red;">This is a paragraph.</p> HTML Fonts <h1 style="font-family:verdana;">This is a heading</h1> <p style="font-family:courier;">This is a paragraph.</p>
  • 25. HTML Text Size <h1 style="font-size:300%;">This is a heading</h1> <p style="font-size:160%;">This is a paragraph.</p> HTML Text Alignment <h1 style="text-align:center;">Centered Heading</h1> <p>This is a paragraph.</p>
  • 26. HTML Text Formatting Elements Tag Description <b> Defines bold text <em> Defines emphasized text <i> Defines italic text <small> Defines smaller text <strong> Defines important text <sub> Defines subscripted text <sup> Defines superscripted text <ins> Defines inserted text <del> Defines deleted text <mark> Defines marked/highlighted text
  • 27. 27 Setting Document Properties  Document properties are controlled by attributes of the BODY element.  For example, there are color settings for the background color of the page, the document’s text and different states of links.
  • 29. 32 Color Codes 1. WHITE 2. BLACK 3. RED 4. GREEN 5. BLUE 6. MAGENTA 7. CYAN 8. YELLOW 9. AQUAMARINE 10. BAKER’S CHOCOLATE 11. VIOLET 12. BRASS 13. COPPER 14. PINK 15. ORANGE 1. #FFFFFF 2. #000000 3. #FF0000 4. #00FF00 5. #0000FF 6. #FF00FF 7. #00FFFF 8. #FFFF00 9. #70DB93 10. #5C3317 11. #9F5F9F 12. #B5A642 13. #B87333 14. #FF6EC7 15. #FF7F00
  • 30. 33 Background Color  To set your document’s background color, you need to edit the <BODY> element by adding the BGCOLOR attribute. The following example will display a document with a white background color: <BODY BGCOLOR=“#FFFFFF”></BODY>
  • 31. 34 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>
  • 32. 35 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: <BODY BACKGROUND=“hi.gif” BGCOLOR=“#FFFFFF”></BODY>
  • 33. 36 Previewing Your Work  Once you have created your basic starting document and set your document properties it is a good idea to save your file.  To save a file, in NotePad, follow these steps: 1. Locate and click on the menu called “File”. 2. Select the option under File Menu labeled “Save As”. 3. In the “File Name” text box, type in the entire name of your file (including the extension name .html).
  • 34. 37 Headings, <Hx> </Hx> 1. H1: should be used as the highest level of heading, H2 as the next highest, and so forth. 2. Examples <H1>He is a web designer</H1> 1. <H2>He is a web designer</H2> 2. <H3>He is a web designer</H3> 3. <H4>He is a web designer</H4> 4. <H5>He is a web designer</H5> 5. <H6>He is a web designer</H6>
  • 35. 38 Headings, <Hx> </Hx> <HTML> <HEAD> <TITLE> Example Page</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> Heading 1 Heading 2 Heading 3 Heading 4 Heading 5 Heading 6
  • 36. 39 Paragraphs, <P> </P>  Paragraphs allow you to add text to a document in such a way that it will automatically adjust the end of line to suite the window size of the browser in which it is being displayed. Each line of text will stretch the entire length of the window.
  • 37. 40 Paragraphs, <P> </P> <HTML><HEAD> <TITLE> Example Page</TITLE> </HEAD> <BODY></H1> Heading 1 </H1> <P> Paragraph 1, ….</P> <H2> Heading 2 </H2> <P> Paragraph 2, ….</P> <H3> Heading 3 </H3> <P> Paragraph 3, ….</P> <H4> Heading 4 </H4> <P> Paragraph 4, ….</P> <H5> Heading 5 </H5> <P> Paragraph 5, ….</P> <H6> Heading 6</H6> <P> Paragraph 6, ….</P> </BODY></HTML> Heading 1 Paragraph 1,…. Heading 2 Paragraph 2,…. Heading 3 Paragraph 3,…. Heading 4 Paragraph 4,…. Heading 5 Paragraph 5,…. Heading 6 Paragraph 6,….
  • 38. 41 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.
  • 39. 42 Break, <BR> <HTML> <HEAD> <TITLE> Example Page</TITLE> </HEAD> <BODY> <H1> Heading 1 </H1> <P>Paragraph 1, <BR> Line 2 <BR> Line 3 <BR>…. </P> </BODY> </HTML> Heading 1 Paragraph 1,…. Line 2 Line 3 ….
  • 40. 43 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>.
  • 41. 44 Horizontal Rule, <HR> Attribute Description Default Value SIZE Height of the rule in pixels 2 pixels WIDTH Width of the rule in pixels or percentage of screen width 100% ALIGN Aligns the line (Left, Center, Right) Center COLOR Sets a color for the rule (IE 3.0 or later) Not set
  • 42. 45 Horizontal Rule, <HR> <HTML> <HEAD> <TITLE> Example Page</TITLE> </HEAD> <BODY> <H1> Heading 1 </H1> <P>Paragraph 1, <BR> Line 2 <BR> <HR>Line 3 <BR> </P> </BODY> </HTML> Heading 1 Paragraph 1,…. Line 2 ______________________ _____ Line 3
  • 43. 46 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).  <B> Bold </B>  <I> Italic </I>  <U> Underline </U>  Color = “#RRGGBB” The COLOR attribute of the FONT element. E.g., <FONT COLOR=“#RRGGBB”>this text has color</FONT>
  • 44. 47 Bold, Italic and other Character Formatting Elements CODING <P> <FONT SIZE=“+1”> One Size Larger </FONT> - Normal – <FONT SIZE=“-1”> One Size Smaller </FONT> <BR> <B> Bold</B> - <I> italics</I> - <U> Underlined </U> - <FONT COLOR=“#FF0000”> Colored </FONT> <BR> <I> Emphasized</I> - <STRONG> Strong </STRONG> output One Size Larger - Normal – One Size Smaller Bold - italics - Underlined - Colored Emphasized -
  • 45. 48 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.
  • 46. 49 Alignment  <DIV ALIGN=“value”></DIV> Represents a division in the document and can contain most other element type. The alignment attribute of the DIV element is well supported.
  • 47. 50 Special Characters & Symbols Special Character Entity Name Special Character Entity Name Ampersand &amp; & Greater-than sign &gt; > Asterisk &lowast; ∗∗ Less-than sign &lt; < Cent sign &cent; ¢ Non-breaking space &nbsp; Copyright &copy; © Quotation mark &quot; " Fraction one qtr &frac14; ¼ Registration mark &reg; ® Fraction one half &frac12; ½ Trademark sign &trade; ™
  • 48. 51 Additional Character Formatting Elements  <STRIKE> strike-through text</STRIKE> DEL is used for STRIKE at the latest browsers  <BIG> places text in a big font</BIG>  <SMALL> places text in a small font</SMALL>  <SUB> places text in subscript position </SUB>  <SUP> places text in superscript style position </SUP>
  • 49. 52 Example <P><STRIKE> strike-through text </STRIKE></BR> <BIG>places text in a big font </BIG><BR> <SMALL> places text in a small font</SMALL><BR> <SUB> places text in subscript position </SUB>Normal <SUP> places text in superscript style position </SUP><BR> </P>
  • 50. 53 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 …
  • 51. 54 Images In this chapter you will learn about images and how to place images in your pages. Objectives Upon completing this section, you should be able to 1. Add images to your pages.
  • 52. 55 Images  <IMG>This element defines a graphic image on the page.  EX:- <IMG SRC=“boy.gif“ border=4> HTML TAG Name of Pic.
  • 53. 56 Images  Width (WIDTH): is the width of the image in pixels.  Height (HEIGHT): is the height of the image in pixels.  Border (BORDER): is for a border around the image, specified in pixels.  HSPACE: is for Horizontal Space on both sides of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space on both sides of the image.  VSPACE: is for Vertical Space on top and bottom of the image specified in pixels. A setting of 5 will put 5 pixels of invisible space above and bellow the image.
  • 54. 57 Some Examples on images 1) <IMG SRC=“boy.gif“ border=4> 2) <IMG SRC=" boy.gif" width="60" height="60"> 3) <IMG SRC=" boy.gif “ Hspace="30" Vspace="10" border=20> 4) < IMG SRC =" jordan.gif“ align="left"> blast blast blast blast blast
  • 55. 58 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. 2) The example below shows how to make the word Here work as a link to yahoo. Click <A HREF="http://www.yahoo.com">yahoo</A> to go to yahoo.
  • 56. 59 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> The Name attribute of an anchor element specifies a location in the document that we link to shortly. All NAME attributes in a document must be unique. 2. Next select the text that you would like to create as a link to the location created above. <A HREF=“#bookmark_name”>Go To Book Mark</A>
  • 57. 60 Tables In this chapter you will learn that tables have many uses in HTML. Objectives: Upon completing this section, you should be able to: 1. Insert a table. 2. Explain a table’s attributes. 3. Edit a table. 4. Add a table header.
  • 58. 61 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>.  The table row elements usually contain table header elements or table data elements.
  • 59. 62 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>
  • 60. 63 Tables Column 1 Header Column 2 Header Row1, Col1 Row1, Col2 Row2, Col1 Row2, Col2
  • 61. 64 Tables Attributes  BGColor: Some browsers support background colors in a table.  Width: you can specify the table width as an absolute number of pixels or a percentage of the document width. You can set the width for the table cells as well.  Border: You can choose a numerical value for the border width, which specifies the border in pixels.  CellSpacing: Cell Spacing represents the space between cells and is specified in pixels.
  • 62. 65 Table Attributes  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.  BorderColor, BorderColorDark.
  • 63. 66 Table Caption  A table caption allows you to specify a line of text that will appear centered above or bellow the table. <TABLE BORDER=1 CELLPADDING=2> <CAPTION ALIGN=“BOTTOM”> Label For My Table </CAPTION>  The Caption element has one attribute ALIGN that can be either TOP (Above the table) or BOTTOM (below the table).
  • 64. 67 Table Header  Table Data cells are represented by the TD element. Cells can also be TH (Table Header) elements which results in the contents of the table header cells appearing centered and in bold text.
  • 65. 68 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.
  • 66. 69 <TABLE BORDER=1 width=50%> <CAPTION> <h1>Spare Parts <h1> </Caption> <TR><TH>Stock Number</TH><TH>Description</TH><TH>List Price</TH></TR> <TR><TD bgcolor=red>3476-AB</TD><TD>76mm Socket</TD><TD>45.00</TD></TR> <TR><TD >3478-AB</TD><TD><font color=blue>78mm Socket</font> </TD><TD>47.50</TD></TR> <TR><TD>3480-AB</TD><TD>80mm Socket</TD><TD>50.00</TD></TR> </TABLE> Basic Table Code
  • 67. 70 <TABLE BORDER width=“750”> <TR> <TD colspan=“4” align=“center”>Page Banner</TD></TR> <TR> <TD rowspan=“2” width=“25%”>Nav Links</TD><TD colspan=“2”>Feature Article</TD> <TD rowspan=“2” width=“25%”>Linked Ads</TD></TR> <TR><TD width=“25%”>News Column 1 </TD> <TD width=“25%”><News Column 2 </TD></TR> </TABLE> What will be the output?
  • 69. 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. Objectives: Upon completing this section, you should be able to 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.
  • 70. 73 Sami Ali Al al-Bayt University EXAMPLE Forms
  • 71. 74 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=“” VALUE=“Send Info”> </P> </FORM> </BODY> </HTML>
  • 72. 75 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>.
  • 73. 76 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.
  • 74. 77 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.
  • 75. 78 <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> Example on Text Box
  • 77. 80  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. Password
  • 78. 81 <HTML><HEAD> <TITLE>Form_Password_Type</TITLE></HEAD> <BODY> <h1> <font color=red>To Access, Please enter:</font></h1> <FORM name="fome2" Action="url" > User Name: <INPUT TYPE="TEXT" Name="FName" SIZE="15" MAXLENGTH="25"><BR> Password: <INPUT TYPE="PASSWORD" NAME="PWord" value="" SIZE="15” MAXLENGTH="25"><BR> </FORM></BODY> </HTML> Example on Password Box
  • 80. 83  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. Hidden inputs have the following attributes:  TYPE: hidden.  NAME: is the name of the variable to be sent to the CGI application.  VALUE: is usually set a value expected by the CGI application. Hidden
  • 81. 84 Check Box  Check Box: Check boxes allow the users to select more than one option. <INPUT TYPE=“CHECKBOX”> Browser will display Checkboxes have the following attributes:  TYPE: checkbox.  CHECKED: is blank or CHECKED as the initial status.  NAME: is the name of the variable to be sent to the CGI application.  VALUE: is usually set to a value.
  • 82. 85 <HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD> <BODY> <h1> <font color=green>Please check one of the following</font></h1> <FORM name="fome3" Action="url" method="get"> <font color=red> Select Country: </font><BR> jordan:<INPUT TYPE="CheckBox" Name="country" CHECKED><BR> Yemen<INPUT TYPE="CheckBox" Name="country"><BR> Qatar:<INPUT TYPE="CheckBox" Name="country"><BR> <BR> <font color=blue>Select Language:</font><BR> Arabic:<INPUT TYPE="CheckBox" Name="language" CHECKED><BR> English:<INPUT TYPE="CheckBox" Name="language"><BR> French:<INPUT TYPE="CheckBox" Name="language"> <BR></FORM> </BODY></HTML>
  • 84. 87  Radio Button: Radio buttons allow the users to select only one option. <INPUT TYPE=“RADIO”> Browser will display Radio buttons have the following attributes:  TYPE: radio.  CHECKED: is blank or CHECKED as the initial status. Only one radio button can be checked  NAME: is the name of the variable to be sent to the CGI application.  VALUE: usually has a set value. Radio Button
  • 85. 88 <HTML> <HEAD><TITLE>CheckBoxType</TITLE> </HEAD> <BODY> <h1> <font color=green>Please check one of the following</font></h1> <FORM name="fome3" Action="url" method="get"> <font color=red> Select Country: </font><BR> jordan:<INPUT TYPE= "RADIO" Name="country" CHECKED><BR> Yemen<INPUT TYPE="RADIO " Name="country"><BR> Qatar:<INPUT TYPE="RADIO" Name="country"><BR> <BR> <font color=blue>Select Language:</font><BR> Arabic:<INPUT TYPE="RADIO" Name="language" CHECKED><BR> English:<INPUT TYPE=" RADIO " Name="language"><BR> French:<INPUT TYPE=" RADIO " Name="language"> <BR></FORM> </BODY></HTML>
  • 86. 89
  • 87. 90  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. Submit Button
  • 88. 91 <FORM Action="URL" method="get"> First Name: <INPUT TYPE="TEXT" Size=25 name="firstName"><BR> Family Name: <INPUT TYPE="TEXT" Size=25 name="LastName"><BR> <BR> <FONT Color=red> Press Here to submit the data:<BR> <INPUT TYPE="submit" VALUE="SubmitData " > </FORM>
  • 89. 92
  • 90. 93 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”> • Browser will display • • Reset buttons have the following attributes: • TYPE: reset. • VALUE: determines the text label on the button, usually Reset.
  • 91. 94
  • 92. 95 • File Upload: You can use a file upload to allow surfers to upload files to your web server. • <INPUT TYPE=“FILE”> • Browser will display • File Upload has the following attributes: • TYPE: file. • SIZE: is the size of the text box in characters. • NAME: is the name of the variable to be sent to the CGI application. • MAXLENGHT: is the maximum size of the input in the textbox in characters. File
  • 93. 96 Other Elements used in Forms  <TEXTAREA></TEXTAREA>: is an element that allows for free form text entry. Browser will display Textarea has the following attributes:  NAME: is the name of the variable to be sent to the CGI application.  ROWS: the number of rows to the textbox.  COLS: the number of columns to the textbox.
  • 94. 97 Other Elements used in Forms  The two following examples are <SELECT></SELECT> elements, where the attributes are set differently.. Select the cities you have visited: <SELECT name=“list” size=5> <option> London</option> <option> Tokyo</option> <option> Paris</option> <option> New York</option> <option> LA</option> <option> KL</option> </SELECT>
  • 95. 98
  • 96. 99 <HEAD> <TITLE>SELECT with Mutiple </TITLE> </HEAD> <BODY> <h2><font color=blue>What type of Computer do you have?</font><h2> <FORM> <SELECT NAME="ComputerType" size=5 multiple> <OPTION value="IBM" > IBM</OPTION> <OPTION value="INTEL"> INTEL</OPTION> <OPTION value=" Apple"> Apple</OPTION> <OPTION value="Compaq" SELECTED> Compaq</OPTION> <OPTION value=" other"> Other</OPTION> </SELECT> </FORM></BODY></HTML>
  • 97. 100