Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use odd and even in css3

Shulou Source: shulou.com Published: 2022-05-31 18:57:05 10月01日 Update

Most people do not understand the knowledge points of this article "how to use odd and even in css3", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use odd and even in css3" article.

In css3, odd and even are used to select the specified element as keywords in the pseudo-class selector, odd for odd elements and even for even elements; odd and even are often used with the ": nth-child (n)" selector, syntax element: selector (odd or even) {css style code} ".

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

What is the use of odd and even in css3

Odd stands for odd number and even for even number.

Odd and even are often used to select a specified element in a pseudo-class selector.

Examples are as follows:

Runoob.com p:nth-child (odd) {background:#ff0000;} p:nth-child (even) {background:#0000ff;} This is a heading

The first paragraph.

The second paragraph.

The third paragraph.

Note: Internet Explorer 8 and and earlier browsers: nth-child () selector.

Output result:

The above is about the content of this article on "how to use odd and even in css3". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Tags: Elements content selections representatives even odd tutorials articles versions knowledge articles code values keywords keywords most that is more styles steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Xiaomi Apple macOS