Introduction To HTML: Internet
Introduction To HTML: Internet
Internet
Difference
z
Internet
Network of networks,
networks in
which millions of
computers are connects
together globally, forming
a network in which any
computer can
communicate with other
computer.
WWW
WWW is a way of
accessing information
over the medium of the
Internet.
The Web uses the HTTP
protocol.
Markup Language
GenCode
1967
TeX
Scribe
1980
SGML
z
z
z
1986
HTML
z
1991
XML
z
11
12
13
Example:
<html>
<head>
<title>Title of page</title>
</head>
<body> This is my first homepage
homepage.
<b>This text is bold</b>
</body>
</html>
14
Example Explanation
z
z
z
z
The first tag in your HTML document is <html>. This tag tells
yyour browser that this is the start of an HTML document. The last
tag in your document is </html>. This tag tells your browser that
this is the end of the HTML document.
The text between the <head> tag and the </head> tag is header
information. Header information is not displayed in the browser
window.
The text between the <title> tags is the title of your document.
The title is displayed in your browser's caption.
The text between the <body> tags is the text that will be
displayed in your browser.
The text between the <b> and </b> tags will be displayed in a
bold font.
Internet Programming by Hassan Khan
15
Tags Attributes
Tags can have attributes. Attributes provide additional information to
an HTML element. e.g.
g <table border="0">
z Attributes always come in name/value pairs like this:
name="value".
z Attributes are always specified in the start tag of an HTML
element.
z Attributes and attribute values are also case-insensitive.
z Attribute values should always be enclosed in quotes. Double
y quotes
q
are the most common,, but single
g style
y q
quotes are
style
also allowed.
z In some rare situations, like when the attribute value itself
contains quotes, it is necessary to use single quotes:
z name='John "ShotGun" Nelson'
Internet Programming by Hassan Khan
16
Headings
Headings are defined with the <h1> to <h6> tags.
<h1> defines the largest heading
heading. <h6> defines the
smallest heading.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This
h5 Thi is
i a heading</h5>
h di
/h5
<h6>This is a heading</h6>
HTML automatically adds an extra blank line before and
after a heading.
Internet Programming by Hassan Khan
17
Paragraphs
Paragraphs are defined with the <p> tag.
<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and
after a paragraph
paragraph.
18
Line Breaks
The <br> tag is used when you want to end a line, but don't
want to start a new paragraph
paragraph.
<p>I <br> Love <br>Pakistan</p>
Note: The <br> tag is an empty tag. It has no closing tag.
19
Comments in HTML
The comment tag is used to insert a comment in the HTML
source code
code. A comment will be ignored by the browser
browser.
<!-- This is a comment -->
20
10
HTML Backgrounds
The <body> tag has two attributes where you can specify backgrounds. The
background can be a color or an image.
Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The
value of this attribute can be a hexadecimal number, an RGB value, or a
color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
Background
The background attribute specifies a background-image for an HTML page.
<body background="clouds.gif">
Internet Programming by Hassan Khan
21
22
11
23
24
12
25
26
13
Text Alignment
z
27
HTML Lists
Unordered Lists
An unordered list starts with the <ul> tag.
tag Each list item starts
with the <li> tag.
<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>
Output:
Coffee
Milk
28
14
HTML Lists
Ordered Lists
An ordered list starts with the <ol> tag.
tag Each list item starts
with the <li> tag.
<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>
Output:
Coffee
Milk
1.
2.
29
HTML Lists
Definition Lists
Definition lists are indented lists without any number or symbol in front of
each item
item.
<dl>
<dt>Coffee</dt>
<dd>Black hot drink</dd>
<dt>Milk</dt>
<dd>White cold drink</dd>
</dl>
Output:
Coffee
Black hot drink
Milk
White cold drink
Internet Programming by Hassan Khan
30
15
Text Formatting
<b>This text is bold</b>
<strong> This text is strong </strong>
<big> This text is big </big>
<em>This text is emphasized</em>
<i>This text is italic</i>
<small>This text is small</small>
This text contains <sub>subscript </sub>
This text contains <sup> superscript
</sup>
31
32
16
Tables
z
Tables are defined with the <table> tag. A table is divided into
rows (with the <tr> tag)
tag), and each row is divided into data cells
(with the <td> tag). The letters td stands for "table data," which is
the content of a data cell. A data cell can contain text, images,
lists, paragraphs, forms, horizontal rules, tables, etc.
33
Example
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
34
17
<table border=0">
<table border="1">
35
Headings in a Table
Headings in a table are defined with the <th> tag.
<table border=
border="1">
1>
<tr>
<th>Heading</th>
<th>Another Heading</th>
</tr>
<tr>
<td>row
td o 1,, cell
ce 1</td>
/td
<td>row 1, cell 2</td>
</tr>
</table>
Internet Programming by Hassan Khan
36
18
37
38
19
<td bgcolor="red">First</td>
<td background=
background=clouds
clouds.jpg
jpg">First</td>
>First</td>
<td align="left">
Internet Programming by Hassan Khan
39
Forms
A form is an area that can contain form elements.
F
Form
elements
l
are elements
l
that
h allow
ll
the
h user to enter
information (like text fields, text area fields, drop-down
menus, radio buttons, checkboxes, etc.) in a form.
<form>
----------------</form>
Internet Programming by Hassan Khan
40
20
41
Radio Button
Radio Buttons are used when you want the user to select
one of a limited number of choices
choices.
<form>
<input type="radio" name="sex" value="male"> Male
<br>
<input type
type="radio"
radio name
name="sex"
sex value
value="female">
female > Female
</form>
42
21
Checkboxes
Checkboxes are used when you want the user to select one or more options
of a limited number of choices
choices.
<form>
I have a bike: <input type="checkbox" name="vehicle" value="Bike" /><br >
I have a car: <input type="checkbox" name="vehicle" value="Car" /><br >
I have an airplane:<input type="checkbox" name="vehicle" value="Airplane" >
</form>
43
44
22
Text Area
<textarea rows="10" cols="30">
The cat was playing in the garden.
garden
</textarea>
45
File Upload
<input type="file"
type= file name=
name="uploadedfile"
uploadedfile >
46
23
Button
<form >
<input type=submit"
type= submit value=
value="Submit!">
Submit! >
</form>
47
48
24
49
50
25