Home > Web Front-end > CSS Tutorial > CSS counter reset property

CSS counter reset property

WBOY
Release: 2023-09-04 22:05:09
forward
1392 people have browsed it

CSS 计数器重置属性

To create or reset a counter using CSS, use the counter-reset property.

You can try running the following code to implement counter-resetAttribute

Example

Live demonstration

<!DOCTYPE html>
<html>
   <head>
      <style>
         body {
            counter-reset: section;
         }
         h2::before {
            counter-increment: section;
            content: "Fruit " counter(section) " - ";
         }
      </style>
   </head>
   <body>
      <h1>Fruits</h1>
      <h2>Mango</h2>
      <h2>Kiwi</h2>
   </body>
</html>
Copy after login

The above is the detailed content of CSS counter reset property. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template