Web Design Using HTML
Web Design Using HTML
What is HTML?
HTML stands for Hyper Text Markup
Language
HTML is the standard markup language for
creating Web pages
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display
the content
HTML elements label pieces of content such as
"this is a heading", "this is a paragraph", "this
G-11
Why Learn HTML?
3
G-11
Why Learn HTML?
5
An HTML editor is a software tool designed to help
users write and edit HTML code.
Web pages can be created and modified by using
professional HTML editors.
However, for learning HTML we recommend a
simple text editor like Notepad (PC) or TextEdit
(Mac).
Other Example:
Visual Studio Code (VS Code)
Notepad++
Eclipse
Dreamweaver
Komodo Edit
G-11
HTML Page Structure
6
Example Explained
The <!DOCTYPE html> declaration
HTML Example defines that this document is an HTML5
document
<!DOCTYPE html> The <html> element is the root element
<html> of an HTML page
The <head> element contains meta
<head> information about the HTML page
The <title> element specifies a title for
<title>Page Title</title> the HTML page (which is shown in the
</head> browser's title bar or in the page's tab)
The <body> element defines the
<body> document's body, and is a container for
all the visible contents, such as headings,
<h1>My First Heading</h1>paragraphs, images, hyperlinks, tables,
<p>My first paragraph.</p>lists, etc.
The <h1> element defines a large
</body> heading
The <p> element defines a paragraph G-11
</html>
HTML Element
7
G-11
HTML Element
8
same as <p>.
The HTML standard does not require lowercase
</body>
</html> G-11
HTML Attributes
10
elements
Attributes are always specified in the start tag
name="value“
The href Attribute
The <a> tag defines a hyperlink. The href attribute
specifies the URL of the page the link goes to:
Example G-11
HTML Attributes
11
G-11
HTML Styles
16
G-11
HTML Quotation and Citation
19
Elements
HTML <blockquote> for Quotations
The HTML <blockquote> element defines a section
that is quoted from another source.
Browsers usually indent <blockquote> elements.
Example
<p>Here is a quote from WWF's website:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html
">
For 60 years, WWF has worked to help people and nature
thrive. As the world's leading conservation organization, WWF
works in nearly 100 countries. At every level, we collaborate
with people around the world to develop and deliver innovative
solutions that protect communities, wildlife, and the places in
which they live.
</blockquote> G-11
HTML Quotation and Citation
20
Elements
HTML <q> for Short Quotations
The HTML <q> tag defines a short quotation.
Browsers normally insert quotation marks around the
quotation.
Example
<p>WWF's goal is to: <q>Build a future where people live in
harmony with nature.</q></p>
HTML <abbr> for Abbreviations
The HTML <abbr> tag defines an abbreviation or an
acronym, like "HTML", "CSS", "Mr.", "Dr.", "ASAP", "ATM".
Marking abbreviations can give useful information to
browsers
Example
G-11
p>The <abbr title="World Health Organization">WHO</abbr> was
HTML Quotation and Citation
21
Elements
HTML <address> for Contact Information
The HTML <address> tag defines the contact information for
the author/owner of a document or an article.
The contact information can be an email address, URL,
physical address, phone number, social media handle, etc.
The text in the <address> element usually renders in italic,
and browsers will always add a line break before and after
the <address> element.
Example
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address> G-11
HTML Quotation and Citation
22
Elements
HTML <cite> for Work Title
The HTML <cite> tag defines the title of a creative
work (e.g. a book, a poem, a song, a movie, a painting,
etc.).
Note: A person's name is not the title of a work.
The text in the <cite> element usually renders in italic.
Example
<p><cite>The Scream</cite> by Edvard Munch. Painted in
1893.</p>
G-11
CSS Colors
26
RGB Colors
An RGB color value represents RED, GREEN, and BLUE
light sources.
In CSS, a color can be specified as an RGB value, using
this formula:
rgb(red, green, blue)
Each parameter (red, green, and blue) defines the
intensity of the color between 0 and 255.
For example, rgb(255, 0, 0) is displayed as red, because
red is set to its highest value (255) and the others are set
to 0.
To display black, set all color parameters to 0, like this:
rgb(0, 0, 0).
To display white, set all color parameters to 255, like this:
G-11
CSS Colors
27
RGBA Colors
RGBA color values are an extension of RGB color
values with an alpha channel - which specifies the
opacity for a color.
An RGBA color value is specified with:
rgba(red, green, blue, alpha)
The alpha parameter is a number between 0.0
(fully transparent) and 1.0 (not transparent at all):
Example
Experiment by mixing the RGBA values below:
style="background-color:rgba(255, 0, 0, 0.3);“
style="background-color:rgba(255, 0, 0, 0.9);"G-11
CSS Colors
28
HEX Colors
A hexadecimal color is specified with: #RRGGBB,
where the RR (red), GG (green) and BB (blue)
hexadecimal integers specify the components of
the color.
In CSS, a color can be specified using a
hexadecimal value in the form:
#rrggbb
Hexadecimal values between 00 and ff (same as
decimal 0-255).
Example, #ff0000= red, #000000= black,
#ffffff= white
G-11
CSS Colors
29
HSL Colors
HSL stands for hue, saturation, and lightness.
In CSS, a color can be specified using hue,
saturation, and lightness (HSL) in the form:
hsl(hue, saturation, lightness)
Hue is a degree on the color wheel from 0 to 360. 0
is red, 120 is green, and 240 is blue.
Saturation is a percentage value, 0% means a
shade of gray, and 100% is the full color.
Lightness is also a percentage, 0% is black, 50% is
neither light or dark, 100% is white
G-11
CSS Colors
30
Example
style="background-color:hsl(0, 100%, 50%);"
style="background-color:hsl(240, 100%, 50%);“
style="background-color:hsl(147, 50%, 47%);“
style="background-color:hsl(300, 76%, 72%);“
style="background-color:hsl(39, 100%, 50%);“
style="background-color:hsl(248, 53%, 58%);"
G-11
CSS Colors
31
HSLA Value
HSLA color values are an extension of HSL color
values with an alpha channel - which specifies the
opacity for a color.
An HSLA color value is specified with:
>
G-11
HTML Forms
33
<form>
.
form elements
.
</form>
HTML forms contain form elements.
<input> element.
The <input> element can vary in many
down list:
Example
<select name="cars">
<option value=“BYD">BYD</option>
<option value=“Toyota">Toyota</option>
<option value=“Tasla">Tasla</option>
</select>
G-11
HTML Form Elements
36
Example
<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
G-11
HTML Form Elements
37
button:
Creates a clickable button.
G-11
HTML Form Elements
39
G-11
HTML Form Elements
40
Example
An <input> element with pre-defined
values in a <datalist>:
<form>
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Safari">
</datalist>
</form>
G-11
HTML Form Elements
41
7. HTML <fieldset>
Groups related form elements together.
8. HTML <legend>
Provides a title or caption for a <fieldset>
element.
Describes the purpose or content of the
G-11
HTML Input Types
44
G-11
HTML Input Types
45
G-11
HTML Input Types
46
Example
<form action="">
First name:<br>
<input type="text" name="firstname"
value=“Nahom"><br>
Last name:<br>
<input type="text" name="lastname"
value=“Hailu"><br><br>
<input type="submit" value="Submit">
</form>
G-11
HTML Input Types
47
G-11
HTML Input Types
48
Example
<form>
<input type="button" onclick="alert('Hello
World!')" value="Click Me!">
</form>
G-11
HTML Input Types
51
G-11
HTML Input Types
53
G-11
HTML Input Types
54
G-11
HTML Input Types
56
G-11
HTML Input Types
57
G-11
HTML Input Types
58
G-11
HTML Input Types
59
<form>
E-mail:
<input type="email" name="email">
</form>
G-11
HTML Input Types
60
G-11
HTML Input Attributes
62
G-11