You are here:   HomeHTML LanguageHTML TutorialHTML MARQUEE
by Dinesh Thakur Category: HTML

Unordered lists are used to represent a set of items that have a relation among themselves but do not follow a specific order. The syntax is same as that of ordered list, only <OL> and </OL> tags are replaced by <UL> and </UL>.

In an ordered list items of the lists are numbered (1,2,3,4...; a,b,c,d or I,II, III, IV....) but in an unordered list the items are presented using bullets. The code for an unordered list is given as:

 

<HTML>

       <HEAD><TITLE>UNORDERED LIST </TITLE></HEAD>

<BODY>

         SOFTWARE TESTING METHODS

        <UL TYPE = a>

              <LI> BLACK BOX TESTING

             <LI> WHITE BOX TESTING

             <LI> CONTROL STRUCTURE TESTING

        </UL>

</BODY>

</HTML>



You will realize that an unordered list is represented in the similar way as ordered list, the only difference being that bullets (i.e. A dot or other symbol placed before text, such as items in a list, to add emphasis.) are used instead of numbers to represent each item.

The type attribute

The actual appearance of bullets may vary from browser to browser. Does that mean the choice of the type of bullets is completely with the browser and the user has no control over it? Of course not. HTML does offer additional choices for the bullet appearance using the type attribute.

 

Syntax

 

<UL type = type_of_bullet >

 

type_of_bullet: It takes anyone of the values: circle, square or disc.

Let us write down the HTML document that uses different types of bullets. The code shows how nesting can be done in unordered lists. Note that we can have an ordered list as the list item for an unordered list and vice versa. Also nesting can be done to any number of levels.

 

<HTML>

          <HEAD><TITLE>UNORDERED LIST </TITLE></HEAD>

          <BODY>

                     TYPE OF PRINTERS

                     <UL type = square>

                             <LI> IMPACT PRINTERS

                         <UL type = circle> OR<UL>

                            <LI> DOT MATRIX

                            <LI> CHAIN PRINTER

                            <LI> DRUM PRINTER

                            <LI> INK JET PRINTER

                       </UL>

                            <LI>NON-IMPACT PRINTERS

                       <UL type = disc>

                           <LI> LASER PRINTER

                           <LI> ELECTROSTATIC PRINTER

                           <LI> WAX PRINTER

                      </UL>

               </UL>

        </BODY>

</HTML>

The above example is also that of a nested list. Some browsers may automatically select a different bullet style for each nested layer. However, if you want to get a particular effect, you will have to specify the style explicitly by using the type attribute.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Search Content







Advance Courses



Basic Courses



Advertise with Us