> 웹 프론트엔드 > HTML 튜토리얼 > HTML 비순차 목록

HTML 비순차 목록

WBOY
풀어 주다: 2024-09-04 16:43:52
원래의
726명이 탐색했습니다.

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.

      <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

      HTML 비순차 목록

      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:

      HTML 비순차 목록

      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:

      HTML 비순차 목록

      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:

      HTML 비순차 목록

      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:

      HTML 비순차 목록

      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

      HTML 비순차 목록

      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:

      HTML 비순차 목록

      결론

      이제 HTML에서 정렬되지 않은 목록을 작성하는 방법을 살펴보았습니다. 우리는 순서가 지정되지 않은 블록 요소가 다양한 예제를 통해 웹 페이지를 생성하는 데 어떻게 역할을 하는지 살펴보고 일부 목록 기능을 탐색했습니다. 탐색 메뉴에서도 이를 사용하여 수직으로 표시할 수 있습니다. 순서가 지정되지 않은 목록을 만드는 것은 매우 간단합니다. 최상의 비트 위치를 위해 이 접근 방식을 수정할 위치를 고려하는 것이 중요합니다. 즉, 완벽한 문서는 HTML 목록 형식을 사용하는 것을 선호합니다.

      위 내용은 HTML 비순차 목록의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:php
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿