Академический Документы
Профессиональный Документы
Культура Документы
Internet Technology
Malak Alamri
+
HyperText Markup Language
(HTML)
Chapter 2
October 20, 2014
Agenda
HTML
o
HTML Styles
1.
2.
HTML Colors
3.
4.
HTML Lists
HTML Styling
Every HTML element has a default style (background color is white, text
color is black ...)
Changing the default style of an HTML element, can be done with the style
attribute.
The <font> tag specifies the font face, font size, and font color of text. The
syntax of the <font> tag is:
Value1: The size of the text. Possible values is a number from 1 to 7, like
<font size="4"> Browser default font size is 3, so, you can increase or
decrease font size by using <font> tag like: <font size="+2"> or <font size="1">
Value3: Specifies the text color with a color name like <font color="red">, or
Specifies the text color with a hex code like <font color="#AB0F0C">
<html>
<body>
<p><font size="3" face="Verdana" color="blue"> This is a
paragraph.</font></p>
<p><font size="5" face="Times" color="red"> This is another
paragraph.</font></p>
</body>
</html>
2- HTML Colors
The most common methods for specifying colors in HTML are by using the
color name or the hexadecimal value. Color names are easier to remember
but the hexadecimal values provide you more color options.
A hexadecimal notation for the combination of Red, Green, and Blue color
values (RGB). The lowest value that can be given to one of the light sources is
0 (Hexadecimal 00). The highest value is 255 (Hexadecimal FF).
Hexadecimal values are written as 3 double digit numbers, starting with a #
sign, like "#f1c265".
There are 16 color names, the following table shows these color names and
their corresponding hexadecimal value.
+ 2- HTML Colors
Color
Hexadecimal
Color
Color
Hexadecimal
Color
Name
Value
Name
Value
Black
#000000
Green
#008000
Silver
#c0c0c0
Lime
#00ff00
Gray
#808080
Olive
#808000
White
#ffffff
Yellow
#ffff00
Maroon
#800000
Navy
#000080
Red
#ff0000
Blue
#0000ff
Purple
#800080
Teal
#008080
Fuchsia
#ff00ff
Aqua
#00ffff
<body bgcolor="value">
Attribute Values
Value
Description
color_name
<html>
<body bgcolor="yellow">
<h2>Look: Colored Background!</h2>
</body>
</html>
<body background="value">
<html>
<head><title>Image</title></head>
<body background="C:\Users\Asus\Pictures\111.jpg">
<p align = center>Aljouf university</p>
</body>
</html>
The text attribute in <body> tag specifies the color of the text in a document.
<body text="value">
<html>
<body text="green">
<p align = right>Aljouf University </p>
</body>
</html>
Top and left margins in <body> tag used to specify the margin from top and
left of the web page.
<html>
<body topmargin="40" leftmargin="30">
Hi
</body>
</html>
Hi
In any HTML tag the attributes of the tag can share the same tag. See the
following example.
<html>
<body text="red" bgcolor="lightgray" topmargin="40"
leftmargin="30">
Hi <br>
Welcome
</body>
</html>
Hi
Welcome
+ 4-HTML Lists
HTML supports three types of lists: Ordered, Unordered and Definition lists.
1- Unordered (Un-Numbered) Lists
An unordered list is a list of items. The list items are marked with bullets
(typically small black circles). An unordered list starts with the <ul> tag. Each
list item starts with the <li> tag.
Syntax:
<ul type="value">
<li> list item 1 <li>
<li> list item 2 <li>
+ 4-HTML Lists
Value:
Style
Description
list-style-type:disc
list-style-type:circle
list-style-type:square
4-HTML Lists
<html>
<body>
<h4>Disc bullets list:</h4>
<ul type="disc">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li></ul>
<h4>Circle bullets list:</h4>
<ul type="circle">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li></ul>
<h4>Square bullets list:</h4>
<ul type="square">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li></ul>
</body>
</html>
4-HTML Lists
4-HTML Lists
2- Ordered (Numbered) Lists
An ordered list is also a list of items. The list items are marked with numbers.
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.
the only difference between an ordered list and an unordered list is the first
letter of the list definition ("o" for ordered, "u" for unordered).
Syntax:
<ol type="value">
<li> list item 1 <li>
<li> list item 2 <li>
<li> list item n <li>
</ol>
+ 4-HTML Lists
Value:
Type
Description
type="1"
type="A"
type="a"
type="I"
type="i"
+ 4-HTML Lists
<html>
<body>
<h4>Numbered list:</h4>
<ol>
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ol>
<h4>Letters list:</h4>
<ol type="A">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ol>
<h4>Lowercase letters list:</h4>
<ol type="a">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li>
</ol>
<h4>Roman numbers list:</h4>
<ol type="I">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li></ol>
<h4>Lowercase Roman numbers
list:</h4>
<ol type="i">
<li>Apples</li>
<li>Bananas</li>
<li>Lemons</li>
<li>Oranges</li></ol>
</body>
</html>
+ 4-HTML Lists
Numbered list:
1. Apples
2. Bananas
3. Lemons
4. Oranges
Letters list:
A.Apples
B. Bananas
C.Lemons
D.Oranges
+ 4-HTML Lists
3- Definition Lists
A definition list is not a list of single items. It is a list of items (terms), with a
description of each item (term). A definition list starts with a <dl> tag
(definition list).Each term starts with a <dt> tag (definition term).Each
description starts with a <dd> tag (definition description).
Syntax:
<dl>
<dt>term 1</dt>
<dd> term 1 description </dd>
<dt>term 2</dt>
<dd> term 2 description </dd>
<dt>term n</dt>
<dd> term n description </dd>
</dl>
+ 4-HTML Lists
<dl>
<dt>CPU</dt>
<dd>Central Processing Unit</dd>
<dt>ALU</dt>
<dd>Arithmetic and Logic Unit</dd>
</dl>
+ 4-HTML Lists
CPU
Central Processing Unit
ALU
Arithmetic and Logic Unit
Inside the <dd> tag you can put paragraphs, line breaks, images, links, other
lists, etc.
+ 4-HTML Lists
5-Nested Lists
<html>
<body>
<h4>A nested List:</h4>
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea
<ul>
<li>China</li>
<li>Africa</li>
</ul>
</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
+ 4-HTML Lists
Thanks