search

HTML Unordered List

Sep 04, 2024 pm 04:43 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

Lists in HTML are a concept of gathering a number of data or elements arranged in a specific order organized for the purpose of being used in the program execution. HTML uses three types of lists, namely Ordered List, Unordered List and Definition List, where Unordered List is a type of list where the data or elements can be arranged in the list in no specific order. The syntax for the HTML Unordered List is

  • ………..
, where
    is the tag that indicates the unordered list type.

    The three types of lists we could use to bring order to the web pages. Below are the different types:

  1. Ordered List
  2. Unordered list
  3. Definition List

In this article, we shall go through the unordered list specification with an example. The unordered list is a list that doesn’t require any order of numbering in their list; instead, we use bullets for the list levels.

Syntax of HTML Unordered List

The syntax for the unordered list is similar to the ordered list we created in the previous article. Unordered list is created using an element named

    element and ends with
tag. The list item is embedded inside the
    element.

  • ………..

Example #1

This shows how this short item list is implemented in a browser.


<title> Demo on Unordered list</title><br>   

<h1 id="u-Demo-on-Unordered-list-u"><u>Demo on Unordered list</u></h1>
<h2 id="Ingredients-for-making-of-cake">Ingredients for making of cake</h2>
<h3>
<ul type="square">
<li>Baking Powder</li>
<li>Flour</li>
<li> Sugar</li>
<li>Coco poder</li>
</ul>
<h3>

</h3>
</h3>

Output:

This will give you the result like

HTML Unordered List

Example #2

Unordered List with colors and for the positions.



<title>unordered list Demo2</title>


<h1 id="Unordered-Disc">Unordered Disc</h1>
  • Lion
  • Tiger
  • Giraffe
  • Camel

Top Rhymes

  • Johny Johny Yes papa
  • Wheels on the Bus
  • Baa Baa Black Sheep

Fruits Name List

  • Avacado
  • Orange
  • Pears
  • Banana

Output:

HTML Unordered List

Types of Attributes for HTML Unordered List

To figure the unordered list, there are three primary types of attributes for this unordered element. The unordered list is used where it is not required to represent the lists in any specific orders. The following sections explain the related attributes and examples of them.

This attribute gives the type of bullets to be used in the list.

  • type =’disc’ – Gives default bullet structure
  • type =’square’ – Looks like solid box bullets
  • type =’circle’ – Gives Hollow box structure

1. Attribute type=’disc.’

This is the default type, and all the items are marked as bullets. Here we use type attribute, and all these attributes support in HTML 3, To define under HTML5, we are supposed to implement list-style CSS. Here is an example demo.

Example:


<title> Demo on Unordered list Types</title><br>   

<h1 id="u-Demo-on-Unordered-list-Types-u"><u>Demo on Unordered list Types</u></h1>
  • This is Program Agenda.
    • First a Welcome Note
    • Second We Start with the talks
  • Opening Speech
  • Mrs.Claria Winston from Ireland and Eyjolfur From Bank of America.
  • Tea Break
  • Last part from the topic Data Lake By Surendran Thomas.

Output:

HTML Unordered List

2. Attribute type=’square.’

Here the items are marked with Square bullets.

Example:

Demonstrating the HTML code with the square bullet embedded with style color and the position.



<meta name="viewport" content="width=device-width, initial-scale=1.5">
<style>
ul {
list-style: square;
}
ul li::before {
content: "\1022";
color: pink;
font-weight: bold;
display: inline-block;
width: 0.8em;
margin-left: -1em;
}
</style>


<h2 id="List-of-top-hollywood-movies-Square">List of top hollywood movies-Square</h2>
  • World Of the wars
  • Mission Impossible
  • Independence Day special
  • Behind enemy lines

Output:

HTML Unordered List

3. Attribute type=’circle.’

This attribute gives hollow bullet values. Below are the example rendering circle and square attribute together with the nested lists.

Example:


<title> EDUCBA List Example </title>
;style>
h3{
color:orange;
}
ul{
list-style: none;
}
ul li::before {
content: "\25AA";
color: brown;
display: inline-block;
width: 1em;
margin-left: -0.8em;
font-weight: bold;
font-size:1rem;
}



<h1 id="List-of-Mobiles"> List of Mobiles</h1>
  • Redmi Xiami
  • Iphone
  • Samsung
  • Nokia

Mobile Operating System Supports

  • Android
  • Windows phone
  • Samsung
  • Nokia

Output:

HTML Unordered List

Replacing HTML list Items with Customizable Images

This would ultimately enhance the overall theme and makes the website visually good. The default bullets are replaced by native style or even can customizable using images with CSS help. Actually speaking, there are three styling lists to be used in HTML. Here we go with a list-style-type and list-style-image.

Using image bullet is to make the lists more unique and differentiate the information by type, Giving the presentation a look on the web page.

In the below example, the examples are demonstrated by style properties between the list elements.

Example #1 – Style properties between the list elements



<title>HTML unordered list with Styles</title>


<style>
ul li {
background: red;
}
ul.in.li {
list-style: circle inside none;
color: red;
left: -20px;
position: inside;
text-align: left;
width: 27px;
}</style>
  • Finland is a Scandinavian Country
  • Oslo is the capital city
  • Iceland is known for its beauty , hiking, fishing
  • Ranked among the chillness country in europe

Output:

This will give out the output like

HTML Unordered List

Example #2 – With image style



<style>
ul {
list-style-image: url('sqpurple.gif');
}
</style>


<h2 id="The-list-style-Demo">The list-style- Demo</h2>
<p>Harry Potter Characters:</p>
  • Harry
  • Hermione
  • Ron Weasely

Output:

HTML Unordered List

Conclusion

Now that we come across how to build unordered lists in HTML. We have seen how the unordered block element plays a role in creating web pages with different examples and explored some list features. Even this can be used in navigation menus to display vertically. The creation of an Unordered list is very simple; it is key important to consider where to fix this approach for the best bit place. In other words, the perfect document prefers to use an HTML list format.

The above is the detailed content of HTML Unordered List. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML's Purpose: Enabling Web Browsers to Display ContentHTML's Purpose: Enabling Web Browsers to Display ContentMay 03, 2025 am 12:03 AM

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

Why are HTML tags important for web development?Why are HTML tags important for web development?May 02, 2025 am 12:03 AM

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

Explain the importance of using consistent coding style for HTML tags and attributes.Explain the importance of using consistent coding style for HTML tags and attributes.May 01, 2025 am 12:01 AM

A consistent HTML encoding style is important because it improves the readability, maintainability and efficiency of the code. 1) Use lowercase tags and attributes, 2) Keep consistent indentation, 3) Select and stick to single or double quotes, 4) Avoid mixing different styles in projects, 5) Use automation tools such as Prettier or ESLint to ensure consistency in styles.

How to implement multi-project carousel in Bootstrap 4?How to implement multi-project carousel in Bootstrap 4?Apr 30, 2025 pm 03:24 PM

Solution to implement multi-project carousel in Bootstrap4 Implementing multi-project carousel in Bootstrap4 is not an easy task. Although Bootstrap...

How does deepseek official website achieve the effect of penetrating mouse scroll event?How does deepseek official website achieve the effect of penetrating mouse scroll event?Apr 30, 2025 pm 03:21 PM

How to achieve the effect of mouse scrolling event penetration? When we browse the web, we often encounter some special interaction designs. For example, on deepseek official website, �...

How to modify the playback control style of HTML videoHow to modify the playback control style of HTML videoApr 30, 2025 pm 03:18 PM

The default playback control style of HTML video cannot be modified directly through CSS. 1. Create custom controls using JavaScript. 2. Beautify these controls through CSS. 3. Consider compatibility, user experience and performance, using libraries such as Video.js or Plyr can simplify the process.

What problems will be caused by using native select on your phone?What problems will be caused by using native select on your phone?Apr 30, 2025 pm 03:15 PM

Potential problems with using native select on mobile phones When developing mobile applications, we often encounter the need for selecting boxes. Normally, developers...

What are the disadvantages of using native select on your phone?What are the disadvantages of using native select on your phone?Apr 30, 2025 pm 03:12 PM

What are the disadvantages of using native select on your phone? When developing applications on mobile devices, it is very important to choose the right UI components. Many developers...

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.