English

Explain <Ol> and <Ul> Tag Used in Html with Example - Computer Science 1

Advertisements
Advertisements

Question

Explain <OL> and <UL> tag used in HTML with example

Solution

HTML supports ordered, unordered and definition lists

Different List Tags are:

<OL>   Defines an ordered list

<UL>  Defines An Unordered List

<LI>  Defines a list item

<DL>  Defines a definition list

<DT>  Defines a definition term

<DD>  Defines a definition description

Unordered Lists:-

An unordered list is a list of items. The list items are marked with bullets (typically small black circles).

To make an unnumbered, bulleted list,

  • Start with an opening list <UL>  (for unnumbered list) tag Enter the <LI>  (list item) tag followed by the individual item; no closing </LI> tag is needed
  • End the entire list with a closing list </UL>

Inside a list item, you can put paragraphs, line breaks, images, links, other lists, etc.

Example

 <HTML>
 <BODY>
 <H4>This is Unordered List</H4>
  <UL type = "circle">
  <LI>Sunday</LI>
  <LI>Monday</LI>
  <LI>Tuesday</LI>
  </UL>
 </BODY>
 </HTML>

so output given by browser is:

This is Unordered List:

  •  Sunday
  •  Monday
  •  Tuesday

By specifying type attribute in the <UL>  tag you can change the shape of the bullet. The standard shapes provided are "disk", "circle" and "square"

Ordered Lists:-

An ordered list is also a list of items.

The list items are marked with numbers.

An ordered list also called an numbered is identical to an unnumbered list, except it uses <OL>  instead of <UL>

Inside a list item, you can put paragraphs, line breaks, images, links, other lists, etc. You can specify the style of numbering for the list items by giving type attribute in the <OL> tag and it can take values "I"  for uppercase roman, "i" for lower case roman, "A" for uppercase letters, "a" for lower case alphanumeric letter.

The start attribute in the <OL>  tag is used to start the list from the required number. e.g <OL start = "6"> will start the list items from number 6.

Example:

<HTML>
<BODY>
  <H4><B>This is an Ordered List</B></H4>
  <OL type = "i">
  <LI>Sunday</LI>
  <LI>Monday</LI>
  <LI>Tuesday</LI>
  </OL>
</BODY>
 </HTML>

so output given by browser is:

This is an Ordered List:

i)  Sunday

ii)  Monday

iii)  Tuesday

shaalaa.com
Hyper Text Markup Language (HTML)
  Is there an error in this question or solution?
2017-2018 (March)

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×