HTML 1
HTML 1
BIT 381
HTML Introduction
HTML is the standard markup language for creating Web pages
• The <head> element contains meta information about the HTML page
• The <title> element specifies a title for the HTML page (which is
shown in the browser's title bar or in the page's tab)
• 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.
<!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>
The <!DOCTYPE> Declaration
• The <!DOCTYPE> declaration represents the document type, and helps browsers
to display web pages correctly.
• It must only appear once, at the top of the page (before any HTML tags).
<!DOCTYPE html>
HTML Headings
HTML Headings
HTML Paragraphs
HTML Links
HTML attributes
• Syntax:
• name = “value”
1) The href attribute
• The <a> tag defines a hyperlink
• The href attribute specifies the URL of the page the link goes to
• Example
• <a href = https://www.yu.edu.jo”> visit Yarmouk University web page
</a>
2) The src attribute
• The <img> tag is used to embed an image in an HTML page.
• The src attribute specifies the path of the image to be displayed on the
web page.
• Example: <img src = “…….path……”>
3) The width and height attributes
• The <img> tag should contain the width and height of the image in
pixels.
• Example:
• <img src= “……path…..” width=“200” height = “250”>
4) The alt attribute
• The alt attribute for the <img> tag specifies an alternate text for an
image , if the image for some reasons can not be displayed.
• Example:
• <img src="C:\Users\Qaisd\Desktop\Spring 2021\Examples at Home\petra.JFIF" width = "200" height = "250" alt = "PETRA Jordan" >
5) The style attribute
Some colors in HTML5
continue
The HTML Style Attribute
• <tagname style="property:value;">
• The property is a CSS property.
• The value is a CSS value.
• We will do more examples about CSS later
in this semester.
Background Color
Set background color for two different elements:
Text Color
Border Color
Fonts
Text Alignment
HTML Text Formatting
• The HTML < mark> element defines text that should be marked or
highlighted:
Example1
Example-2
Example-3
6) The lang attribute
7) The title attribute
HTML Comments
style Example
HTML5 Document Example
Web Page
HTML Colors
HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA
values.
Color Names
In HTML, a color can be specified by using a color name:
Example-2:
An RGB color value represents RED, GREEN, and BLUE light sources.
Each parameter (red, green, and blue) defines the intensity of the color with a value between 0 and 255.
This means that there are 256 x 256 x 256 = 16777216 possible colors!
HTML RGB and RGBA Colors
For example, rgb(255, 0, 0) is displayed as red, because red is set to its
highest value (255), and the other two (green and blue) 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: rgb(255, 255, 255).
HTML RGB and RGBA Colors
HTML RGB and RGBA Colors
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:rgb(255, 0, 0);">rgb(255, 0, 0)</h1>
<h1 style="background-color:rgb(0, 0, 255);">rgb(0, 0, 255)</h1>
<h1 style="background-color:rgb(60, 179, 113);">rgb(60, 179, 113)</h1>
<h1 style="background-color:rgb(238, 130, 238);">rgb(238, 130, 238)</h1>
<h1 style="background-color:rgb(255, 165, 0);">rgb(255, 165, 0)</h1>
<h1 style="background-color:rgb(106, 90, 205);">rgb(106, 90, 205)</h1>
</body>
</html>
HTML RGB and RGBA Colors
Shades of Gray
Shades of gray are often defined using equal values for all three parameters:
HTML RGB and RGBA Colors
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:rgb(60, 60, 60);">rgb(60, 60, 60)</h1>
<h1 style="background-color:rgb(100, 100, 100);">rgb(100, 100, 100)</h1>
<h1 style="background-color:rgb(140, 140, 140);">rgb(140, 140, 140)</h1>
<h1 style="background-color:rgb(180, 180, 180);">rgb(180, 180, 180)</h1>
<h1 style="background-color:rgb(200, 200, 200);">rgb(200, 200, 200)</h1>
<h1 style="background-color:rgb(240, 240, 240);">rgb(240, 240, 240)</h1>
</body>
</html>
HTML RGB and RGBA Colors
RGBA Color Values
RGBA color values are an extension of RGB color values with an Alpha channel -
which specifies the opacity for a color.
The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not
transparent at all):
HTML RGB and RGBA Colors
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:rgba(255, 99, 71, 0);">rgba(255, 99, 71, 0)</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.2);">rgba(255, 99, 71, 0.2)</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.4);">rgba(255, 99, 71, 0.4)</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.6);">rgba(255, 99, 71, 0.6)</h1>
<h1 style="background-color:rgba(255, 99, 71, 0.8);">rgba(255, 99, 71, 0.8)</h1>
<h1 style="background-color:rgba(255, 99, 71, 1);">rgba(255, 99, 71, 1)</h1>
</body>
</html>
HEX Color Values
In HTML, a color can be specified using a hexadecimal value in the form:
#rrggbb
Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0-255).
For example, #ff0000 is displayed as red, because red is set to its highest value (ff), and the other two (green and
Another example, #00ff00 is displayed as green, because green is set to its highest value (ff), and the other two (red
To display black, set all color parameters to 00, like this: #000000.
To display white, set all color parameters to ff, like this: #ffffff.
HEX Color Values
HTML HSL and HSLA Colors
HSL stands for hue, saturation, and lightness.
HSLA color values are an extension of HSL with an Alpha channel (opacity).
In HTML, a color can be specified using hue, saturation, and lightness (HSL) in the
form:
Shades of gray are often defined by setting the hue and saturation to 0, and