Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write singular li in css3

Shulou Source: shulou.com Published: 2022-05-31 20:44:32 09月21日 Update

This article introduces the relevant knowledge of "how to write singular li in css3". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The singular li in css3 is written as "li:nth-child (odd)"; the ": nth-child" selector is used to match specified child elements that belong to its parent element. When the parameter in the selector is set to "Odd", it indicates that the matching subscript is an odd child element, where the subscript of the first child element is "1".

The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.

What is the writing of singular li in css3

The nth-child (n) selector matches the Nth child element that belongs to its parent element, regardless of element type.

N can be a number, keyword, or formula.

Odd and even are keywords that can be used to match child elements where the subscript is odd or even (the subscript of the first child element is 1).

So it is written as follows:

Li:nth-child (odd)

Examples are as follows:

Li:nth-child (odd) {background:#ff0000;} Coffee Tea Milk

Note: Internet Explorer does not support the: nth-child () selector.

Output result:

This is the end of "how to write singular li in css3". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Elements writing odd subscript selection size key keywords content odd more knowledge output practicality achievement next even number formula parameter dilemma Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux NVidia Apple Shulou Tech Info