HTML-LISTS
HTML-LISTS
Learning Objectives
• <body> attribute
• Inserting Image
• Adding Superscript and Subscript
• Adding Comments
• Creating Lists in HTML
<body>
• <body topmargin=50>
• <body leftmargin=100>
• <body rightmargin=100>
• This attribute is used to set margin for the webpge.
• <body text=“red”> In the webpage the entire color of the text will become
red color.
• <body background=“pic.jpg”> The background of the webpage will be a
picture.
• <body bgcolor=“yellow”> The background of the webpage will be yellow
color.
Inserting Images
• Images makes the webpage more information and appealing.
• Web browsers support various graphics support.
- GIF (Graphics Interchange Format)
- PNG (Portable Network Graphics)
- JPEG (Joint Photographic Expert Group)
Types of Images
• Inline Image
-The inline image is displayed when the webpage is opened and is inserted
with a line of text.
• External Image
- Extenal images are not displayed automatically with other content on the
web page.They are referenced externally and viewed separately by clicking a
link.
<IMG>Tag
• The html Tag is used to add images in HTML Webpage.
Empty or Container?
It is an empty tag , and the tag is <img>.
<IMG> Attributes
• It tells the browser how to layout the page so that text can flow properly
around the image.
src - Defining the source of an image.
height & width - Specifying height and width for an image.
align- Aligning Image
alt- ALT Attribute.
border-Add a border for the image
<img src="https://spiderman-4-1920x1080-wallpaper.jpg" width="100"
height="100" border="20" alt="There is an image" align="right">
Defining the source of an image
• To add and define the source of an image on a web page,src attribute is used.
Syntax: <img src=“address or path of the image file”
Ex1: <img src=“pic1.jpg”>
Ex2: <img src=“C:\Users\pictures\pic1.jpg”>
Ex3: <img src=”http://www.google.com/images/pic1.jpg”>
Specifying Height and Width for an Image
• The height attribute specifies height for an image either in the form of an
integer or a percentage value.
• The width attribute specifies width for an image either in the form of an
integer or a percentage value.
Ex: <IMG SRC=“pic1.jpg” HEIGHT=70% WIDTH=50%>
<IMG SRC=“pic1.jpg” HEIGHT=20 WIDTH=50>
Aligning Image
• To align an image to the right or left of a text and Top, middle and bottom
of the image.
Ex: <img src=“pic1.jpg” align=“top”>
Border
• To add border to the inserted image and its value can be an integer number
which helps to set the thickness of the border.
Ex: <img src=“pic1.jpg” BORDER=2>
ALT Attribute
• The ALT attribute specify the text as an alternate to the image, if the image
cannot be displayed.
• The user is having a text-based browser on his computer such as Lynx.
• The alt attribute provides alternative information for an image if a user for
some reason cannot view it (because of slow connection, an error in the src
attribute)
ALT Attribute
I LOVE UAE
• Also add a comment for the webpage.
Creating Lists in HTML
• Advantages
-Information arranged in proper manner.
- Increases the readability.
- Appearance of the webpage.
- To display some related items or terms in a web page.
Types of List
• Ordered List
• Unordered List
• Definition List
Ordered List
• It is also known as numbered list. It is used to create a sequential list of items.
ie; A list in which each item is placed at a specific position.
• HTML provides <OL> tag to create such lists.
Syntax: <OL>
<LI> ORANGE
<LI> APPLE
</OL>
An ordered list is created using Arabic numerals starting with number 1 by default.
Ordered List Attributes
• Type: This attribute can be used to change the numbering style. This
attribute can take five different values:
1------Arabic Numerals
A------Uppercase Alphabets
a-------Lowercase Alphabets
I-------- Uppercase Roman Letters
i---------Smallcase Roman letters.
Ordered List Attributes
• Start:This attribute is used when the number list is to be started with some
number other than 1.
Ex: <OL TYPE=A>
<LI>CPU
<LI>Keyboard
<LI>Mouse
</OL>
Ordered List Attributes
<OL TYPE=A START=3>
<LI>CPU
<LI>Keyboard
<LI>Mouse
</OL>
WHAT IS THE OUTPUT??
Ordered List Attributes
• Value: This attribute can be used within <LI> tag of an ordered list to
change the numbering sequence in between the list.
EX : <OL>
<LI>CPU
<LI>keyboard
<LI Value=6>Mouse
</OL>
Ordered List Attributes
• TYPE: This attribute When used in specific <LI> tag changes the numbering style
of specific item.
EX : <OL>
<LI>CPU
<LI>keyboard
<LI>Mouse
<LI Type=“A”>Monitor
</OL>
Unordered List
• It is also known as bulleted list and is used to present the list items in an organized
manner irrespective of their positions in the list .
• HTML provides <UL> tag
• Syntax: <UL>
<LI>ORANGE
<LI>APPLE
</UL>
By default a solid black circle is used to mark the individual list items
<UL> Attributes
• Type: It can be used to select the bullet style.
• Three Types
DISC(a solid black circle)
Square( a solid black square)
Circle (a hollow black circle)
DISC
<UL TYPE="DISC">
<LI>ORANGE
<LI>APPLE
</UL>
SQUARE
<UL TYPE=‘’SQUARE’’>
<LI>ORANGE
<LI>APPLE
</UL>
CIRCLE
<UL TYPE=‘’CIRCLE’’>
<LI>ORANGE
<LI>APPLE
</UL>
TYPE
<UL TYPE=‘’SQUARE’’>
<LI>ORANGE
<LI TYPE=‘’CIRCLE’’>APPLE
<LI>GRAPES
</UL>
Practice Session-Task 3
• Create an Ordered List and Unordered List on the
following.
Definition List
• It is used to organize the items and their descriptions in the HTML webpage.
• HTML provides <DL> tag to create a such list.
• Each item has two parts: Term & Definition.
Syntax: <DL>
<DT>term1</DT>
<DD> Term1 description </DD>
<DT>term2</DT>
<DD> Term2 description </DD>
</DL>
Definition List
<dl>
<dt>Bread</dt>
<dd>A baked food made of flour.</dd>
<dt>Coffee</dt>
<dd>A drink made from roasted coffee beans.</dd>
</dl>
OUTPUT:
<DL> Attribute
Compact: It does not take any value, but appears with in the tag to show the
term and its description in the same line.
- It is not supported by Google chrome or Mozilla.
- It is supported by Internet explorer and that too create the descriptions of
very short terms.
Practice Session-Task
Create a definition List for the following text.
Nested Lists
• The list items in a list are further subcategorized forming another list of items with in the
list. Such type of lists are called Nested Lists.
<HTML>
<HEAD>
<TITLE>NESTED LISTS</TITLE>
</HEAD>
<BODY>
<UL>
<LI>FRUITS
<UL TYPE=CIRCLE>
<LI>ORANGE
<LI>APPLE
<LI>BANANA</LI>
</UL>
</UL>
</BODY>
</HTML>
HOME WORK
• Create a Nested List in your webpage as shown below: