HTML Course
HTML Course
Definition
“HTML is a language that defines
basic structure of a website.”
Note:
In order to learn how to write web pages, it is
very important to understand how to structure
document.
2
In this class you will learn:
3
Elements
The HTML code is made up of characters that live inside
the angled bracket.
<p> </p>
• The Closing tag has an extra forward slash in it.
• Each HTML element tells the browser something about
the information that sits between its opening and
closing tag.
4
Opening tag
Character
Note:
• The characters in the brackets
<p>
indicate the tag purpose.
For example:
In this tag the p stands for
paragraph.
Character
Note:
• The Closing tag has a forward
</p>
slash after the < symbols.
Forward Slash
Opening tag Closing tag
<p> Content
</p>
Element
Note:
• We can say tag = element,
but actually element is tags + its full content.
7
Basic Structure of HTML
html
head
body
8
Another example of HTML Structure
9
Body, Head and Title
<body> </body>
Everything inside this element is shown inside
the main browser window.
<head> </head>
This contains information about the page.
<title> </title>
The content of this element are shown in the
tab of the browser. 10
Tab Main Browser Window
Everything inside body element will be shown inside this main browser window.
11
12
You will learn about:
13
Headings
14
Headings
code result
15
Paragraphs
To create a paragraph, surround the words that make
up the paragraph with an opening <p> tag and closing
</p> tag.
<p>
code
result
16
Bold
By enclosing words in the tags <b> and </b> we can
make characters appear bold.
<b>
code
17
Bold
result
<b>
18
Italic
By enclosing words in the tags <i> and </i> we can
make characters appear italic.
<i>
code
19
Italic
result
<i>
20
Superscript & Subscript
Superscript: The <sup> element is used to contain characters
that should be superscript such as the suffixes of dates or
mathematical concepts like raising a number to a power such as
22. <sup>
example 12th E = mC2
Subscript: The <sub> element is used to contain characters
<sub>
that should be subscript. It is commonly used with foot notes or
chemical formulas such as H20.
<sup>
<sub>
22
Self Closing Tags
Line Breaks & Horizontal Rules
23
Self Closing Tags
Line Breaks & Horizontal Rules
<br/>
<hr/>
The use of <strong> element indicates that its content has strong
importance. <strong>
The <em> element indicates emphasis that subtly changes the
meaning of a sentence.
<em>
25
Strong & Emphasis
<strong>
<em>
26
27
Lists
There are lots of occasions when we need to use lists.
HTML provides us with three different types:
1 Ordered
2 Unordered
3 Definition
28
Lists
Ordered list: Ordered list are lists where each item in the list
is numbered.
29
Ordered lists
30
Ordered lists
<ol>
<li>
31
Unordered lists
32
Unordered lists
<ul>
<li>
33
Definition lists
The definition list is created with the <dl> element and usually
consist of a series of terms and their definitions.
Inside the <dl> element you will usually see pairs of <dt> and <dd>
<dl>
elements.
<dt> is used to contain the term being defined (the definition term) <dt>
<dd> is used to contain the definition.
<dd>
34
Definition lists
<dl>
<dt>
<dd>
35
Nested lists
You can use a second list inside an <li> element to create a sub-list
or nested list.
36
Attribute
Attribute provides additional information about the content of an
element.
They appear on the opening tag of the element and are made up
of two parts: a name and a value, separated by an equals sign.
Attribute Attribute
name value
Definition
Links are the defining feature of the web because they allow you
to move from one web page to another. <a>
You will commonly come across the following type of links:
39
Links
Links are created using the <a> element. Users can click on
anything between the opening <a> tag and the closing </a> tag.
You specify which page you want to link to using the href attribute.
<a>
example
<a href= “# ” > Google</a>
40
Linking to other site
41
Linking to other pages on the same site
When you linking to other pages within the same site, you do not
need to specify the domain name in the URL.
If all the pages of the site are in the same folder, then the value of
<a>
the href attribute is just the name of the file.
example
42
Linking to other pages on the same site
Directory Structure
Grandchild
<a href= “links/page/About.html” > About</a>
Folder
Grandparent
<a href= “../../About.html” > About</a>
Folder
43
Opening links in a new window
If you want a link open in a new window, you can use the target
attribute on the opening <a> tag. The value of this attribute should
be _blank.
<a>
example
44
45
Tables
What is a Table?
A table represents information in a grid format.
example
46
Basic Table Structure
47
Table Headings
The <th> element is used just like the <td> element but its purpose
is to represent the heading for either a column or a row.
(The th stands for table heading.)
<th>
<th>
48
colspan & rowspan Attribute
colspan
rowspan
49
Long Tables
There are three elements that help distinguish between the main content
of the table and the first and last rows.
These elements help you to style these sections in a different manner
than the rest of the table (as you will see when you learn about CSS).
The headings of the table should sit inside the <thead> element.
<thead>
The body should sit inside the <tbody> element.
<tbody>
The footer belong inside the <tfoot> element.
<tfoot>
50
51
Forms
HTML forms give you a set of elements to collect data from your
users.
52
Form Controls
There are several types of form controls that you can use to collect
information from visitors to your site.
Text Input
Adding Text Password Input
Text Area
Radio Buttons
Making Choices Check Boxes
Drop-down Boxes
Submit Buttons
Submitting Forms
Image Buttons
<form>
54
Adding Text
Text Input Password Input Text Area
type = “ text ” type = “password”
<form>
<textarea> </textarea>
<input>
55
Adding Text
Text Input Password Input Text Area
Attributes
name
Attributes
name
Attributes
name
<form>
size size cols <input>
maxlength maxlength rows
56
Making Choices
Check Boxes Radio Buttons Drop-down
type = “checkbox” type = “ radio ” <select>
<option> </option>
<option> </option>
<form>
</select>
<input>
57
Making Choices
Check Boxes Radio Buttons Drop-down
Attributes
name
Attributes
name
Attributes
in <select>
name
<form>
value value
in <option>
value <input>
checked checked disabled
selected
58
Uploading Files
File Upload
type = “ file ”
<form>
<input>
59
Submitting Forms
Submit Buttons Image Button
type = “ submit ” type = “ image ”
<form>
<input>
60
Submitting Forms
Submit Buttons Image Button
name
Attributes
src
Attributes
<form>
value width <input>
height
61
Grouping Form Elements
<legend> <fieldset>
<form>
<input>
<fieldset>
<legend>
62
Date and Email
Date Input Email Input
<form>
type = “ date ” type = “ email ”
<input>
63
64
Doctype
<!DOCTYPE html>
<!DOCTYPE html>
Because there have been several versions of HTML, each web page
should begin with a DOCTYPE declaration to tell a browser which
version of HTML the page is using
65
Comments
<!-- -->
<!-- comment goes here -->
If you want to add a comment to your code that will not be visible in
the user's browser, you can add the text between these characters
66
ID Attribute
67
Class Attribute
the value of class can be repeated, multiple tags can have same
value of class.
68
Block Elements
69
Inline Elements
70
Grouping Elements in a Block
<div>
The <div> element allows you to group a set of elements together in
one block-level box.
<div>
71
Grouping Elements in an Inline
<span>
The <span> element acts like an inline equivalent of the <div>
element.
<span>
72
Iframes
<iframe>
<iframe>
An iframe is like a little window that has been cut into your page —
and in that window you can see another page. The term iframe is an
abbreviation of inline frame.
Attributes
1. src
2. height
3. width
73