How to create an unordered list with square bullets in HTML?

HTMLWeb DevelopmentFront End Technology

A list is a connected items written consecutively (usually one below other). Using HTML, you can create two kinds of lists unordered list and ordered list.

An ordered list is numbered and an unordered list is not numbered it can be created with the tag <ul></ul> and define the items of the list using the tag <li></li>. We can create 4 types of unordered list in HTML −

  • disc − This creates an unordered list marked to a bullet (default).

  • circle − This creates an unordered list marked to a circle.

  • square − This creates an unordered list marked to a square.

  • none − This creates an unordered list without any marker.

Syntax

Following is the syntax to create an unordered list with square bullets in HTML.

<ul style="list-style-type: square">
   <li>Item in list…</li>
   <li>Item in list…</li>
   <li>Item in list…</li>
</ul>

Example 1

Given below is an example to create an unordered list with square bullets in HTML.

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <ul style="list-style-type: square"> <li>Abdul</li> <li>Jason</li> <li>Yadav</li> <li>Saiteja</li> <li>Akshaj</li> <li>Tharun</li> </ul> </body> </html>

Following is the output for the above example program.

Example 2

The following code is run to create an unordered list with square bullets in HTML −

<!DOCTYPE html> <html> <head> <title>HTML Unordred List</title> </head> <body> <h1>Developed Countries</h1> <p>The list of developed countries :</p> <ul style="list-style-type:square"> <li>US</li> <li>Australia</li> <li>New Zealand</li> </ul> </body> </html>

After executing the above code, the output is obtained as −

raja
Updated on 18-Oct-2022 11:05:34

Advertisements