zoukankan      html  css  js  c++  java
  • css计数器自动生成序号

    CSS 计数器

    CSS 计数器通过一个变量来设置,根据规则递增变量。


    使用计数器自动编号

    CSS 计数器根据规则来递增变量。

    CSS 计数器使用到以下几个属性:

    • counter-reset - 创建或者重置计数器
    • counter-increment - 递增变量
    • content - 插入生成的内容
    • counter() 或 counters() 函数 - 将计数器的值添加到元素

    案列

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>菜鸟教程(runoob.com)</title>
    <style>
    body {  # 这里一定要写在body下
    counter-reset: section;
    }

    h2::before {  # 这里可以随意指定标签或者类或者ID
    counter-increment: section;
    content: "Section " counter(section) ": ";
    }
    </style>
    </head>
    <body>

    <h1>使用 CSS 计数器:</h1>
    <h2>HTML 教程</h2>
    <h2>CSS 教程</h2>
    <h2>JavaScript 教程</h2>

    <p><b>注意:</b> IE8 需要指定 !DOCTYPE 才可以支持该属性。</p>

    </body>
    </html>

    案列2

    {% extends 'query.html' %}

    {% block content %}
    <style>
    body {
    counter-reset: number;
    }

    li:before {
    counter-increment: number;
    content: "序号:" counter(number);
    }
    </style>
    <body>
    {% for user_info in user_one %}
    <div style="height: auto; 1000px;margin: 0;">
    <ul class="list-group">
    <li style="font-size: 14px;" class="list-group-item">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- 姓名:{{ user_info.name }} / 性别:{{ user_info.sex }} /
    生日:{{ user_info.birthday }} /
    电话:{{ user_info.user_info.phone }} / 地址:{{ user_info.user_info.addr }} --</li>
    </ul>
    </div>
    </body>
    {% endfor %}
    {% endblock %}
  • 相关阅读:
    重写trim方法时摸索出的删除数组长度的思路
    常用String类方法-Java
    Lambda入门,看这一篇幅就够了
    利用Spring AOP的通知类型以及创建通知
    SpringAOP基础
    Java开发中解决Js的跨域问题
    从properties中读取配置创建对象
    SpringBoot打包为war包,并在tomcat中运行
    查看SpringBoot应用中的嵌入式tomcat的版本
    Mybatis中返回Map
  • 原文地址:https://www.cnblogs.com/shizhengquan/p/10839061.html
Copyright © 2011-2022 走看看