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
- ………..
- 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:
- Ordered List
- Unordered list
- 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
- 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
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:
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:
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:
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:
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
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 中构建无序列表。我们已经通过不同的示例了解了无序块元素如何在创建网页中发挥作用,并探索了一些列表功能。即使这也可以用在导航菜单中垂直显示。无序列表的创建非常简单;考虑在哪里修复此方法以获得最佳位非常重要。换句话说,完美的文档更喜欢使用 HTML 列表格式。
以上是HTML 无序列表的详细内容。更多信息请关注PHP中文网其他相关文章!

HTML的核心目的在于让浏览器理解并展示网页内容。1.HTML通过标签定义网页结构和内容,如、到、等。2.HTML5增强了多媒体支持,引入了和标签。3.HTML提供了表单元素,支持用户交互。4.优化HTML代码可提升网页性能,如减少HTTP请求和压缩HTML。

htmltagsareessentialforwebdevelopmentastheyandendenhancewebpages.1)heSdefinElayout,语义和互动性。2)SemantictagsiCtagSimproveCacsibilitieAndseo.3)pose poseriblesibilityAndseoandseo.3)poser

一致的HTML编码风格很重要,因为它提高了代码的可读性、可维护性和效率。1)使用小写标签和属性,2)保持一致的缩进,3)选择并坚持使用单引号或双引号,4)避免在项目中混合使用不同风格,5)利用自动化工具如Prettier或ESLint来确保风格的一致性。

在Bootstrap4中实现多项目轮播的解决方案在Bootstrap4中实现多项目轮播并不是一件简单的事情。虽然Bootstrap...

如何实现鼠标滚动事件穿透效果?在我们浏览网页时,经常会遇到一些特别的交互设计。比如在deepseek官网上,�...

无法直接通过CSS修改HTML视频的默认播放控件样式。1.使用JavaScript创建自定义控件。2.通过CSS美化这些控件。3.考虑兼容性、用户体验和性能,使用库如Video.js或Plyr可简化过程。

在手机上使用原生select的潜在问题在开发移动端应用时,我们常常会遇到选择框的需求。通常情况下,开发者倾...

在手机上使用原生select的弊端是什么?在移动设备上开发应用时,选择合适的UI组件是非常重要的。许多开发者�...


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

SublimeText3汉化版
中文版,非常好用

WebStorm Mac版
好用的JavaScript开发工具

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器