Tag <ul> In HTML

The purpose of this article is to explore Tag <ul> with examples to satisfy learning objectives.

Html tag <ul> stands for Unordered List and is designed to arrange items without a numerical order, whose order in the list is random. Items in unordered lists are typically displayed with bullets, which can take different forms, such as dots, circles, and squares.

The <ul> tag is commonly used to create navigation menus, bullet lists, or any other list of items that do not require a specific order or ranking

Here’s an example of an unordered HTML list of technology companies in the world:

Example: 

<!DOCTYPE html> <html> <body> <ul> <li>Apple</li> <li>Microsoft</li> <li>Google</li> <li>Amazon</li> <li>Facebook</li> <li>Alphabet</li> <li>IBM</li> <li>Oracle</li> <li>Samsung</li> <li>Sony</li> </ul> </body> </html>

CSS can be used to style the list type of <ul> tag here is how:

Example: 

<!DOCTYPE html> <html> <body> <ul> <li style="list-style-type: square;">Apple</li> <li>Microsoft</li> <li style="list-style-type: circle;">Google</li> <li>Amazon</li> <li style="list-style-type: disc;">Facebook</li> <li>Alphabet</li> <li style="list-style-type:lower-alpha;">IBM</li> <li>Oracle</li> <li style="list-style-type: decimal;">Samsung</li> <li>Sony</li> </ul> </body> </html>

Appling line-height with CSS to different <li> items:

Example: 

<!DOCTYPE html> <html> <body> <ul> <li style="line-height: 50px;">Apple</li> <li>Microsoft</li> <li style="line-height: 40px;">Google</li> <li>Amazon</li> <li style="line-height: 30px;">Facebook</li> <li>Alphabet</li> <li style="line-height: 20px;">IBM</li> <li>Oracle</li> <li style="line-height: 10px;">Samsung</li> <li>Sony</li> </ul> </body> </html>

Nested list in the <ul> tag can be created as follow:

Example: 

<!DOCTYPE html> <html> <body> <ul> <li>Trending Technology <ul> <li>Artificial Intelligence</li> <li>Machine Learning</li> <li>Cloud Computing <ul> <li>AWS</li> <li>Azure</li> <li>Google Cloud</li> </ul> </li> <li>Blockchain</li> <li>IoT</li> <li>5G</li> </ul> </li> </ul> </body> </html>
Advice: You can style lists using CSS.

Here’s an example of a more complex nested unordered list:

Example: 

<!DOCTYPE html> <html> <body> <ul> <li>Trending Technology <ul> <li>Trending Technology <ul> <li>Artificial Intelligence <ul> <li>Natural Language Processing</li> <li>Computer Vision</li> <li>Robotics</li> </ul> </li> <li>Machine Learning <ul> <li>Supervised Learning</li> <li>Unsupervised Learning</li> <li>Reinforcement Learning</li> </ul> </li> <li>Cloud Computing <ul> <li>AWS <ul> <li>EC2</li> <li>S3</li> <li>Lambda</li> </ul> </li> <li>Azure <ul> <li>Virtual Machines</li> <li>Storage</li> <li>Azure Functions</li> </ul> </li> <li>Google Cloud <ul> <li>Compute Engine</li> <li>Storage</li> <li>App Engine</li> </ul> </li> </ul> </li> <li>Blockchain <ul> <li>Bitcoin</li> <li>Ethereum</li> <li>Hyperledger</li> </ul> </li> <li>IoT <ul> <li>Smart Home</li> <li>Wearable Devices</li> <li>Industrial IoT</li> </ul> </li> <li>5G</li> </ul> </li> </ul> </li></ul></body> </html>

Here is an example of the nested list with some css applied to it for further clarification:

Example: 

<!DOCTYPE html> <html> <head> <style> ul { list-style-type: circle; } li { color: green; } ul ul { background-color: #eee; } li { font-size: 18px; } </style> </head> <body> <ul> <li>Nature <ul> <li>Forests <ul> <li>Tropical Rainforests</li> <li>Temperate Forests</li> <li>Boreal Forests</li> </ul> </li> <li>Mountains <ul> <li>Rocky Mountains</li> <li>Himalayas</li> <li>Andes</li> </ul> </li> <li>Oceans <ul> <li>Atlantic Ocean</li> <li>Pacific Ocean</li> <li>Indian Ocean</li> </ul> </li> <li>Deserts <ul> <li>Sahara Desert</li> <li>Arabian Desert</li> <li>Gobi Desert</li> </ul> </li> <li>Grasslands <ul> <li>Prairies</li> <li>Savannas</li> <li>Steppes</li> </ul> </li> </ul> </li> </ul> </body> </html>
Advice: If you want to create ordered lists, use the <ol> tag.


Tag Ul Uses

The Tag Ul represents a list in unordered order (bulletted).

Put the <ul> tag in conjunction with the <li> tag to make an unordered list.

Following are some key uses of the <ul> tag:

  • The <ul> tag is often used in combination with the <li> tag, which defines each item in the list.
  • By default, the items in an unordered list are displayed as bullet points, but this can be changed using CSS.
  • The <ul> tag can also be used to create nested lists, where one list is contained within another list.
  • The <ul> tag is a semantic tag, which means that it provides meaning and context to the content on the page.
  • The use of semantic tags like <ul> is important for accessibility and search engine optimization.

Attributes

Global

The Tag <ul> includes the Global Attributes in HTML.

Event

Tag Ul <ul> also handles the Event Attributes in HTML.


Browser Compatibility

Element
<ul>YesYesYesYesYes

Predefined CSS

Whenever it comes to Tag ul <ul> , many browsers will render the <ul> tag with these default values:

ul {
display: block;
list-style-type: disc;
margin-top: 1em;
margin-bottom: 1 em;
margin-left: 0;
margin-right: 0;
padding-left: 40px;
}

HTML Tag Ul Benefits

The <ul> tag in HTML has several benefits, including:

  • The <ul> tag is a simple and straightforward HTML tag, making it easy for beginners to use and understand.
  • The <ul> tag creates a structured list of items, making it easier for users to understand and navigate the content on the page.
  • The <ul> tag is a semantic tag, which means that it provides meaning and context to the content on the page. This is important for accessibility and search engine optimization.
  • The appearance of unordered lists created with the <ul> tag can be customized using CSS, providing flexibility in the design of the page.
  • The <ul> tag can be used to create navigation menus, bullet lists, or any other list of items that do not require a specific order or ranking.
  • The <ul> tag is a widely supported HTML tag, which means that it will work in most modern web browsers.
If this article somewhere met your educational requirements, then do share this meaningful information with your friends as well by clicking on the links below.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *