HTML Unordered List
Sep 04, 2024 pm 04:43 PMLists 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
- ………..
- is the tag that indicates the unordered list type.
- Ordered List
- Unordered list
- Definition List
The three types of lists we could use to bring order to the web pages. Below are the different types:
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
- element.
<ul> <li></li> ……….. </ul>
Example #1
This shows how this short item list is implemented in a browser.
<html> <head> <title> Demo on Unordered list</title><br>?? </head> <body bgcolor="orange" text="green" order=""> <h1><u>Demo on Unordered list</u></h1> <h2>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> </body> </html>
Output:
This will give you the result like
Example #2
Unordered List with colors and for the positions.
<!DOCTYPE html> <html> <head> <title>unordered list Demo2</title> </head> <body> <h1>Unordered Disc</h1> <ul> <li>Lion</li> <li>Tiger</li> <li>Giraffe</li> <li>Camel</li> </ul> <h1>Top Rhymes </h1> <ul type="square"> <li>Johny Johny Yes papa</li> <li>Wheels on the Bus</li> <li> Baa Baa Black Sheep</li> </ul> <h1>Fruits Name List</h1> <ul type="circle" > <li > Avacado</li> <li> Orange</li> <li>Pears</li> <li> Banana</li> </ul> </body> </html>
Output:
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:
<html> <head> <title> Demo on Unordered list Types</title><br>?? </head> <body bgcolor="pink" text="blue" order=""> <h1><u>Demo on Unordered list Types</u></h1> <UL> <LI>This is Program Agenda. <UL> <LI>First a Welcome Note <LI>Second We Start with the talks </UL> <LI type="square">Opening Speech <LI>Mrs.Claria Winston from Ireland and Eyjolfur From Bank of America. <LI type="circle"> Tea Break <LI type="disk">Last part from the topic Data Lake By Surendran Thomas. </UL> </body> </html>
Output:
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.
<!DOCTYPE html> <html> <head> <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> </head> <body> <h2>List of top hollywood movies-Square</h2> <ul> <li>World Of the wars</li> <li>Mission Impossible</li> <li>Independence Day special</li> <li> Behind enemy lines</li> </ul> </body> </html>
Output:
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:
<HTML> <HEAD> <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; } </style> </HEAD> <BODY> <H1> List of Mobiles</h1> <UL> <LI> Redmi Xiami <LI> Iphone <LI> Samsung <LI> Nokia </UL> <H1>Mobile Operating System Supports</h1> <UL TYPE = "circle"> <LI> Android <LI> Windows phone <LI TYPE = "circle"> Samsung <LI TYPE = "square"> Nokia </UL> </BODY> </HTML>
Output:
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
<!DOCTYPE html> <html lang="en"> <head> <title>HTML unordered list with Styles</title> </head> <body> <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> <ul> <li><span> Finland is a Scandinavian Country</span></li> <li><span>Oslo is the capital city</span></li> <li><span>Iceland is known for its beauty , hiking, fishing</span></li> <li><span>Ranked among the chillness country in europe</span></li> </ul><br/> </body></html>
Output:
This will give out the output like
Example #2 – With image style
<!DOCTYPE html> <html> <head> <style> ul { list-style-image: url('sqpurple.gif'); } </style> </head> <body> <h2>The list-style- Demo</h2> <p>Harry Potter Characters:</p> <ul id="circle"> <li> Harry</li> <li>Hermione</li> <li>Ron Weasely</li> </ul> </body> </html>
Output:
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!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The web page structure needs to be supported by core HTML elements. 1. The overall structure of the page is composed of , , which is the root element, which stores meta information and displays the content; 2. The content organization relies on title (-), paragraph () and block tags (such as ,) to improve organizational structure and SEO; 3. Navigation is implemented through and implemented, commonly used organizations are linked and supplemented with aria-current attribute to enhance accessibility; 4. Form interaction involves , , and , to ensure the complete user input and submission functions. Proper use of these elements can improve page clarity, maintenance and search engine optimization.

When using HTML5SSE, the methods to deal with reconnection and errors include: 1. Understand the default reconnection mechanism. EventSource retrys 3 seconds after the connection is interrupted by default. You can customize the interval through the retry field; 2. Listen to the error event to deal with connection failure or parsing errors, distinguish error types and execute corresponding logic, such as network problems relying on automatic reconnection, server errors manually delay reconnection, and authentication failure refresh token; 3. Actively control the reconnection logic, such as manually closing and rebuilding the connection, setting the maximum number of retry times, combining navigator.onLine to judge network status to optimize the retry strategy. These measures can improve application stability and user experience.

Doctype is a statement that tells the browser which HTML standard to use to parse the page. Modern web pages only need to be written at the beginning of the HTML file. Its function is to ensure that the browser renders the page in standard mode rather than weird mode, and must be located on the first line, with no spaces or comments in front of it; there is only one correct way to write it, and it is not recommended to use old versions or other variants; other such as charset, viewport, etc. should be placed in part.

Client-sideformvalidationcanbedonewithoutJavaScriptbyusingHTMLattributes.1)Userequiredtoenforcemandatoryfields.2)ValidateemailsandURLswithtypeattributeslikeemailorurl,orusepatternwithregexforcustomformats.3)Limitvaluesusingmin,max,minlength,andmaxlen

Use tags in HTML to group options in the drop-down menu. The specific method is to wrap a group of elements and define the group name through the label attribute, such as: 1. Contains options such as apples, bananas, oranges, etc.; 2. Contains options such as carrots, broccoli, etc.; 3. Each is an independent group, and the options within the group are automatically indented. Notes include: ① No nesting is supported; ② The entire group can be disabled through the disabled attribute; ③ The style is restricted and needs to be beautified in combination with CSS or third-party libraries; plug-ins such as Select2 can be used to enhance functions.

HTML5, CSS and JavaScript should be efficiently combined with semantic tags, reasonable loading order and decoupling design. 1. Use HTML5 semantic tags, such as improving structural clarity and maintainability, which is conducive to SEO and barrier-free access; 2. CSS should be placed in, use external files and split by module to avoid inline styles and delayed loading problems; 3. JavaScript is recommended to be introduced in front, and use defer or async to load asynchronously to avoid blocking rendering; 4. Reduce strong dependence between the three, drive behavior through data-* attributes and class name control status, and improve collaboration efficiency through unified naming specifications. These methods can effectively optimize page performance and collaborate with teams.

To use HTML button elements to achieve clickable buttons, you must first master its basic usage and common precautions. 1. Create buttons with tags and define behaviors through type attributes (such as button, submit, reset), which is submitted by default; 2. Add interactive functions through JavaScript, which can be written inline or bind event listeners through ID to improve maintenance; 3. Use CSS to customize styles, including background color, border, rounded corners and hover/active status effects to enhance user experience; 4. Pay attention to common problems: make sure that the disabled attribute is not enabled, JS events are correctly bound, layout occlusion, and use the help of developer tools to troubleshoot exceptions. Master this

It is more convenient to submit form data using HTML5's FormData API. 1. It can automatically collect form fields with name attribute or manually add data; 2. It supports submission in multipart/form-data format through fetch or XMLHttpRequest, which is suitable for file upload; 3. When processing files, you only need to append the file to FormData and send a request; 4. Note that the same name field will be overwritten, and JSON conversion and no nesting structure need to be handled.
