HTML2
HTML2
&
TECHNOLOGI
ES
REVIEW OF THE LESSON
WHAT IS
WWW?
WHO INVENTED THE
WEB?
THE THREE
GENERATIONS OF WEB?
DIFFERENCE BETWEEN
WEBSITE AND WEB
PAGE?
WHAT ARE THE TYPES OF
WEBSITE?
TOPIC:
• HTML Introduction
• HTML Elements and Attributes
• HTML Headings
• HTML Paragraphs
OBJECTIVE
S:
• Discuss about the HTML
• Discuss about the HTML basic structure like
elements, attributes, headings and paragraph.
• Apply the HTML basic structure
INTRODUCTION TO
HTML
WHAT IS
•HTML?
HTML stands for HyperText Markup Language.
• It is a standard markup language for web page creation.
• It is platform independent. This means that the text and the
content are encoded in a way that they can be displayed on a
wide range of computers.
• HTML files usually have the file extension of htm, html, or
shtml.
MARKUP LANGUAGE
VS.
PROGRAMMING
LANGUAGE
• Markup languages are used to structure and format text and
other content on a webpage.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
• The <!DOCTYPE html> declaration defines the document declaration.
• The <html> element is the root element of an HTML page
• The <head> element contains meta information about the HTML page
• The <title> element specifies a title for the HTML page
• The <body> element defines the document's body, and is a container for all the visible
contents, such as headings, paragraphs images, hyperlinks, tables, lists, etc.
• The <h1> element defines a large heading.
• The <p> element defines a paragraph.
HTML
ELEMENT
• An HTML element is defined by a start tag, some content, and an end
tag:
The HTML element is everything from the start tag to the end tag:
</head>
<body>
</body>
</html>
HTML
ELEMENT
Note: HTML is not case-sensitive.
Ex.
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
HTML
ELEMENT
The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>.
Ex.
Ex.
The <a> tag defines a hyperlink. The href attribute specifies the URL
of the page the link goes to.
ex:
<a href="https://www.canva.com/">Welcome to my Web</a>
2. THE SRC
ATTRIBUTE
The <img> tag is used to embed an image in an HTML page.
The src attribute specifies the path to the image to be displayed:
Ex.
<img src="fish.jpg">
3. THE WIDTH AND HEIGHT
ATTRIBUTES
The <img> tag should also contain the width and height attributes,
which specify the width and height of the image (in pixels):
Ex.
<img src="fish.jpg" width="800" height="500">
4. THE ALT ATTRIBUTE
The required alt attribute for the <img> tag specifies an alternate text
for an image, if the image for some reason cannot be displayed. This
can be due to a slow connection, or an error in the src attribute, or if
the user uses a screen reader.
Ex.
<img src="fish.jpg" alt="Finding Nemo">
5. The style Attribute
The style attribute is used to add styles to an element, such as color,
font, size, and more.
Ex.
<p style="color:red;">This is a red paragraph.</p>
6. The title Attribute
Ex.
<p title="I'm a tooltip">This is a paragraph.</p>
HTML HEADINGS
• HTML headings are defined with the <h1> to <h6> tags.
• <h1> defines the most important heading. <h6> defines the least
important heading.
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
HTML paragraphs
• With HTML, you cannot change the display by adding extra spaces or
extra lines in your HTML code.
• The browser will automatically remove any extra spaces and lines when
the page is displayed.
HTML paragraphs
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
HTML Horizontal Rules
• The <hr> tag defines a thematic break in an HTML
page, and is most often displayed as a horizontal rule.
Note: The <hr> tag is an empty tag, which means that it has no end tag.
HTML Line Breaks
• The HTML <br> element defines a line break.
• Use <br> if you want a line break (a new line) without starting a
new paragraph:
Ex.
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
</body>
</html>
exercises:
3. Set the size of the image to 140 pixels wide and 45 pixels tall.
<img src="W3docs.jpg">
exercises:
4. Turn the element below into a link to "https://www.w3docs.com/" by
using the correct attribute.
<h2>A heading
<p>A paragraph
exercises:
6. Set the color of the paragraph to "green" by using the correct HTML
attribute.
.
exercises:
7. Add a "tooltip" to the link, which must say "Go to homepage".
I am Red
I am Blue
I am Big
HTML Styles
<p>I am normal</p>
<p style="color:red;">I am red</p>
<p style="color:blue;">I am blue</p>
<p style="font-size:50px;">I am big</p>
HTML Style Attribute
• Setting the style of an HTML element, can be done with
the style attribute.
<tagname style="property:value;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Background Color
• Set background color for two different
elements:
<h1 style="background-
color:powderblue;">This is a heading</h1>
<p style="background-color:tomato;">This is
a paragraph.</p>
Text Color
• The CSS color property defines the text
color for an HTML element:
<h1 style="font-family:verdana;">This is a
heading</h1>
<p style="font-family:courier;">This is a
paragraph.</p>
Text Size
• The font-size property defines the text size
for an HTML element:
<p>This
is <sub>subscripted</sub> text.</p>
HTML Quotation and
Citation Elements
The HTML <blockquote> element defines a
section that is quoted from another source.
<blockquote>
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>
HTML Quotation and
Citation Elements
HTML <q> for Short Quotations
<address>
Written by John Doe.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
HTML Quotation and
Citation Elements
HTML <cite> for Work Title
Add Comments
<p>This is a paragraph.</p>
HTML Comments
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
<h1 style="background-color:LightGray;">LightGray</h1>
Color Names
https://www.w3schools.com/colors/colors_names.asp
Background Color
Hello World
rgb(128, 0, 128)
Color Values
HSL, which stands for Hue Saturation and Lightness, is
another way of declaring colors in CSS. HSL color value
for the Purple color can be specified as follow:
Red = #FF0000
Green = #008000
Blue = #0000FF
White = #FFFFFF
Ivory = #FFFFF0
Black = #000000
HTML Styles - CSS
CSS stands for Cascading Style Sheets.
With CSS, you can control the color, font, the size of text, the
spacing between elements, how elements are positioned and
laid out, what background images or background colors are to
be used, different displays for different devices and screen
sizes, and much more!
HTML Styles - CSS
Using CSS
Using CSS
Inline CSS
The following example sets the text color of ALL the <h1> elements (on
that page) to blue, and the text color of ALL the <p> elements to red.
In addition, the page will be displayed with a "powderblue" background
color:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
HTML Styles - CSS
External CSS
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Link to External CSS
External style sheets can be referenced with a full URL or with a path
relative to the current web page.
This example links to a style sheet located in the same folder as the
current page:
background-color: powderblue;
h1 {
color: blue;
p{
color: red;
CSS Border
The CSS border property defines a border around an HTML element.
Tip: You can define a border for nearly all HTML elements.
Example
Use of CSS border property:
p{
border: 2px solid powderblue;
}
CSS Padding
The CSS padding property defines a padding (space) between the text
and the border.
Example:
Use of CSS border and padding properties:
p{
border: 2px solid powderblue;
padding: 30px;
}
CSS Margin
The CSS margin property defines a margin (space) outside the border.
Example
Use of CSS border and margin properties:
p{
border: 2px solid powderblue;
margin: 50px;
}
HTML Links
<button onclick="document.location=‘YouTube.com'">H
TML Tutorial</button>
HTML Link Colors
Example:
Here, an unvisited link will be green with no underline.
A visited link will be pink with no underline.
An active link will be yellow and underlined.
In addition, when mousing over a link (a:hover) it will
become red and underlined:
Link Buttons
Example
First, use the id attribute to create a bookmark:
For Example:
Background Repeat
Table Headers
<style>
table, th, td {
border: 1px solid black;
}
</style>
HTML Table Borders
<style>
table, th, td {
border: 1px solid black;
border-radius: 10px;
}
</style>
HTML Table Borders
Skip the border around the table by leaving out table from the
css selector:
<style>
th, td {
border: 1px solid black;
border-radius: 10px;
}
</style>
HTML Table Borders
<style>
th, td {
border-style: dotted;
}
</style>
HTML Table Borders
HTML Table Borders
Border Color
th, td {
border-color: pink;
}
HTML Table Sizes
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
HTML Table Sizes
<table style="width:100%">
<tr>
<th style="width:70%">Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
HTML Table Row Height
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr style="height:200px">
<td>Jill</td>
<td>Smith</td>
HTML TABLE HEADER
<table style="width:100%">
<tr>
<th>Firstname</th>
<td>Jill</td>
<td>Eve</td>
</tr>
Align Table Headers
<table style="width:100%">
<caption>Monthly savings</caption>
HTML Table Padding & Spacing
th, td {
padding-top: 10px;
padding-bottom: 20px;
padding-left: 30px;
padding-right: 40px;
}
HTML Table - Zebra Stripes
tr:nth-child(even) {
background-color: #D6EEEE;
}
Note: Put the :nth-child() selector on both th
and td elements if you want to have the styling
on both headers and regular table cells.
Horizontal Dividers
tr {
border-bottom: 1px solid #ddd;
}
Hoverable Table