How to set the style of ordered and unordered list items in CSS

How to set the style of ordered and unordered list items in CSS

In an unordered list ul>li, the symbol of an unordered list is a dot that appears in front of each list. In the ordered list ol>li, there is a number in front by default. To change the bullet point in front of the list, you only need to adjust it through list-style. Common symbols include (/*content comment part*/) list-style-type:circle;/*hollow circle*/list-style:none;/*remove the sign*/list-style:square;/*square*/list-style:upper-roman;/*Roman numerals*/list-style:lower-alpha;/*list-style-type:upper-alpha; uppercase letters*/, etc.!

The code looks like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>How to play with ordered and unordered list items in CSS</title>
    <style type="text/css">
    ul.box1{
        list-style-type:circle;/*hollow circle*/
    }
    .box1 li{
        list-style:none;/*Remove the logo*/
        background-image: url("https://pic.cnblogs.com/avatar/1350951/20200208114706.png");/*Combination of pictures and text, add pictures in front of the list*/
        height: 50px;
        background-repeat: no-repeat;
        background-size: 20px;
        /*Set the background image size. The image can remain at its original size, be stretched to a new size, or be scaled to fit the available space in the element while maintaining its original proportions. */
        padding: 0px 25px 10px;/*Adjust the inner margins top, left, right and bottom*/
    }
    ul.box2{
        list-style:square;/*square*/
    }
    ul.box3{
        list-style:upper-roman;/*Roman numerals*/
    }
    ul.box4{
        list-style:lower-alpha;/*list-style-type:upper-alpha;Capital letters*/
    }
    ol.box5{
        list-style: none;
        list-style:upper-alpha;
        color: indianred;
    }
    </style>
</head>
<body>
    <!-- Wireless List -->
    <ul class="box1">
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
    </ul>
    <ul class="box2">
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
    </ul>
    <ul class="box3">
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
    </ul>
    <ul class="box4">
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
    </ul>
    <!-- Unordered list replaces ul>li with ol>li ordered list, with a number in front by default-->
    <ol class="box5">
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
        <li>abc</li>
    </ol>
</body>
</html>

Summarize

The style described is the list style setting method of ordered and unordered list items in CSS introduced by the editor. I hope it will be helpful to everyone!

<<:  js simulation to achieve the effect of enlarging the picture on the Jingdong details page

>>:  Common properties of frameset (dividing frames and windows)

Recommend

JavaScript Document Object Model DOM

Table of contents 1. JavaScript can change all HT...

Alibaba Cloud Server Ubuntu Configuration Tutorial

Since Alibaba Cloud's import of custom Ubuntu...

A super detailed Vue-Router step-by-step tutorial

Table of contents 1. router-view 2. router-link 3...

The implementation process of ECharts multi-chart linkage function

When there is a lot of data to be displayed, the ...

Docker deploys mysql to achieve remote connection sample code

1.docker search mysql查看mysql版本 2. docker pull mys...

Detailed explanation of Vue life cycle

Table of contents Why understand the life cycle W...

Application nesting of HTML ul unordered tables

Application nesting of unordered lists Copy code T...

Linux system calls for operating files

Table of contents 1. Open the file Parameter Intr...

Making a simple game engine with React Native

Table of contents Introduction Get started A brie...

Steps to transfer files and folders between two Linux servers

Today I was dealing with the issue of migrating a...

How to convert a string into a number in JavaScript

Table of contents 1.parseInt(string, radix) 2. Nu...

JavaScript implements the generation of 4-digit random verification code

This article example shares the specific code for...

Solution to Vue's inability to watch array changes

Table of contents 1. Vue listener array 2. Situat...