Detailed explanation of the usage of content attribute in css

王林
Release: 2020-04-30 09:12:13
forward
5813 people have browsed it

Detailed explanation of the usage of content attribute in css

The content attribute is generally used in ::before and ::after pseudo-elements to present the content of the pseudo-element.

Detailed explanation of usage

1. Insert pure characters

Detailed explanation of the usage of content attribute in css

  

1、插入纯字符

Copy after login

(Video tutorial recommendation:css video tutorial)

2. Insert pictures

Detailed explanation of the usage of content attribute in css

  

2、插入图片

Copy after login

3. Insert element attributes

Detailed explanation of the usage of content attribute in css

  

3、插入元素属性

Copy after login

4. Insert the current element number (i.e. the current element index)

This feature can be used for rule introduction on active pages.

Detailed explanation of the usage of content attribute in css

  

4、插入当前元素编号(即当前元素索引)

  • 我是第1个li标签
  • 我是li标签中的第1个div标签
  • 我是第2个li标签
  • 我是第3个li标签
  • 我是li标签中的第2个div标签
  • 我是第4个li标签
  • 我是第5个li标签
Copy after login

5. Insert the current element number (specified type)

Detailed explanation of the usage of content attribute in css

  

5、插入当前元素编号(指定种类)

  • 我是第1个li标签
  • 我是li标签中的第1个div标签
  • 我是第2个li标签
  • 我是第3个li标签
  • 我是li标签中的第2个div标签
  • 我是第4个li标签
  • 我是第5个li标签
Copy after login

Recommended tutorial:css quick getting Started

The above is the detailed content of Detailed explanation of the usage of content attribute in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:jb51.net
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!