search

HTML Ordered List

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

In this section, we will learn how to implement Ordered Lists in HTML. How to describe or display an ordered list? It’s very simple and easy; they are used to describe the list of information in the content. And another technique is a single list can have multiple lists elements on them.

The lists in HTML can be classified into three types, they are:

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

In this article, we shall go through the ordered list specification with an example. The ordered list defines the specific ordered information when a list is created; for instance, it shows ordinate information or numbering the information.

Syntax of Ordered List

Ordered list is created using a tag named

    element and ends with
tag.

HTML Ordered List

Examples of Ordered List

Let us see some example mentioned below:

Example #1



<title>HTML Ordered List</title>


<p><strong>There are 6 different airlines:</strong></p>
<ol type="1">
<li>Jet Blue Airlines</li>
<li>Frontier Airlines</li>
<li>South West Airlines</li>
<li> Spirit Airlines</li>
<li> United Airlines</li>
<li>America Airlines</li> </ol>

Output:

This will give you the result like

HTML Ordered List

Example #2

Ordered List with colors. In the following example, we have used a certain counter property, defines the automatic counting list-items in the

  • . It is just an internal variable of CSS to enable counting functions.
    
    
    <title>HTML Ordered List with colors</title>
    
    
    <style>
    ol li {
    counter-increment: list;
    list-style-type: none;
    position: relative;
    }
    ol li:before {
    color: #ff0000;
    content: counter(list) ".";
    left: -22px;
    position: absolute;
    text-align: center;
    width: 24px;
    }</style>
    <ol>
    <li><span> Norway is a Scandinavian Country</span></li>
    <li><span>Oslo is the capital city</span></li>
    <li><span>norway is known for its beauty , hiking, fishing</span></li>
    <li><span>Ranked among the toppest country in europe</span></li>
    </ol><br>
    

    Output:
    HTML Ordered List

    Types of Attributes for HTML Ordered List

    To represent the ordered list, there are five important types of attributes for this tag. As the HTML

      tag represents the list of items in the ordered list, they can be either in alphanumeric, numeric or simply alphabetical order, provided order is the primary thing. Here are the possible attributes of the Ordered list:

      1. The Type attribute

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

    • type =’a’ – Gives alphabetical order
    • type =’A’- Gives Upper case Alphabetical order
    • type =’i’ – Gives Roman number lower case
    • type =’ I’- Gives Upper case Roman numbers

    These type of numbering are mentioned below:

    I.  Attribute type=’a.’

    To make a list in alphabetical lower case, this type is used. The following example shows the ordered list in the lowercase and made it in italic.

    Example:

    
    
    <title>HTML Ordered List types</title>
    
    
    <style>
    ol li span {
    font-weight: normal;
    }
    </style>
    <p>Did you know that:</p>
    <p>Skills required to become a data Scientist</p>
    <ol type="a">
    <li><span><i> steps</i></span></li>
    <li><span><b>There should be a prior knowledge in SAS and R programming.</b></span></li>
    <li>
    <span><b>They should have a strong calibre in creativity and analysis</b></span><b></b>
    </li>
    </ol>
    
    

    Output:

    HTML Ordered List

     II. Attribute type=’A.’

    An ordered list can have an attribute type of alphabet lowercase. The below example demonstrates how to use this attribute in the list structure and also how to make the letters in bold. To have the ordered list in bold, it is to be declared using

    Example:

    
    
    <title> Example for Nested list</title>
    
    
    <p> State capitals of the united States</p>
    <style>
    ol {
    font-weight:bolder;
    }
    ol li span {
    font-weight: normal;
    }
    </style>
    <ol type="A">
    <li> <span>Alabama
    <ul>
    <li>Montgomery</li>
    </ul>
    </span>
    </li>
    <li>
    <span>Arizona
    <ul>
    <li>Phoenix</li>
    </ul>
    </span>
    </li>
    <li> <span>California
    <ul>
    <li>Sacramento</li>
    </ul>
    </span>
    </li>
    <li> <span>New jersey
    <ul>
    <li>Trenton</li>
    </ul>
    </span>
    </li>
    <li>
    <span>Washington
    <ul>
    <li>Olympia</li>
    </ul></span>
    </li>
    <li> <span>Pennsylvannia
    <ul>
    </ul></span> </li>
    <li>Harisburg</li>
    </ol>
  • Output:

    HTML Ordered List

    III. Attribute type=’i.’

    This functionality indicates lower case roman letters.

    Example:

    
    
    <title>HTML Ordered List types</title>
    
    
    <p> EDUCBA HTML List Tutorial:</p>
    <ol>
    <li value="4">Ordered list</li>
    <li>unordered list</li>
    <li>Definition list
    <ol type="i">
    <li> <i>Introduction to list </i>
    </li>
    <li><i>Syntax a List</i></li>
    <li>
    <i> Types with an example</i>
    </li>
    </ol>
    </li>
    <li>Snapshots</li>
    </ol>
    

    Output:

    HTML Ordered List

    IV. Attribute type=’ I.’

    This functionality gives the output in Upper Roman Numerals.

    Example:

    
    
    <title>HTML Ordered List Demo</title>
    
    
    <h2> List of Vegetables
    <ol type="I">
    <li>Carrot</li>
    <li> Radish</li>
    <li> Sweet Corn</li>
    </ol>
    <ol>
    <li>Fruits List
    <ol type="a">
    <li>Pomegrante</li>
    <li>Bananas</li>
    <li>Pears</li>
    </ol>
    </li>
    
    </ol>
    </h2>

    Output:

    HTML Ordered List

    2. The Start Attribute

    The start attribute defines the start value for the ordered list numbers. You can start with any number from the beginning, not just from the default number ‘1’. Example: start=6. It’s been used now in HTML5.

    Example:

    In the following example, I have used style type to upper_alpha along with a start from =3; therefore, the output is shown from ‘C’.

    
    
    <title> Example for Nested list</title>
    
    
    <p> RICHEST COUNTRIES IN THE WORLD</p>
    <style>
    ol { list-style-type: upper-alpha;
    font-weight:bolder;
    }
    ol li span {
    font-weight: normal;}
    </style>
    <ol start="3">
    <li>Quatar known for his oil and petrochemical reserves</li>
    <li>Norway known for the beauty of nature with petroleum producer</li>
    <li>Singapore with global trade center</li>
    </ol>
    
    

    Output: 

    HTML Ordered List

    3. The Reverse Attribute

    This is the new attribute introduced in HTML5, which indicates the items are displayed in the reverse order in the web browsers. To use,

      it’s a Boolean attribute taking any value to it to reverse the counter. Declared
        in the
          tag.

          Example:

          
          
          <title>HTML Ordered List</title>
          
          
          <h2 id="How-to-do-Balle-Technique">How to do Balle Technique</h2>
          <ol>
          <li>Turn out</li>
          <li>Alignment</li>
          <li>Pointed Toes</li>
          </ol>
          <hr>
          <h2 id="Balle-Steps"> Balle Steps</h2>
          <ol reversed="True">
          <li>Seven Movements</li>
          <li>Plier</li>
          <li>Etendre </li>
          <li>Glisser</li>
          <li>Eliever</li>
          </ol>
          
          

          Output:

          HTML Ordered List

          Conclusion

          Therefore, I have summarized what the ordered list has done to the end, and it is almost supported in all browsers. Certainly, you can create any numbers of lists in the HTML tag element; in this article, we just focused on selected examples to understand the basic implementation. Thus, learning this topic might not the toughest job, as the

          1. tag used here is very simple to remember.

    The above is the detailed content of HTML Ordered 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
    From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

    HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

    Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

    WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

    The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

    The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

    HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

    HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

    HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

    HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

    The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

    HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

    Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

    HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

    What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

    AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

    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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Best Graphic Settings
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. How to Fix Audio if You Can't Hear Anyone
    3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25: How To Unlock Everything In MyRise
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    DVWA

    DVWA

    Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    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.

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools