content 属性,用在after,before伪元素上,用于在选中的元素前后插入内容。

插入的内容多种多样,

  • 纯文字
h1::after{
content:"h1后插入内容"
}
h1{
quotes:"(" ")";
}
h1::before{
content:open-quote;
}
h1::after{
content:close-quote;
}
  • 图片
h3::after{
content:url(xxx/new.gif)
}
  • 元素属性
a:after{
content:attr(href);
}
  • 编号

    这里抄一段张大神的代码,CSS计数器内嵌demo,

    编号这里会牵涉到一些属性

    • counter-reset
    • counter-increment
    • counter/counters

      当然不用担心,张大神的 css counter计数器给了很详细的解答
<style>
.reset { padding-left: 20px; counter-reset: wangxiaoer; line-height: 1.6; color: #666; }
.counter:before { content: counters(wangxiaoer, '-') '. '; counter-increment: wangxiaoer; font-family: arial black; }
</style>
<div class="reset">
<div class="counter">我是王小二
<div class="reset">
<div class="counter">我是王小二的大儿子</div>
<div class="counter">我是王小二的二儿子
<div class="reset">
<div class="counter">我是王小二的二儿子的大孙子</div>
<div class="counter">我是王小二的二儿子的二孙子</div>
<div class="counter">我是王小二的二儿子的小孙子</div>
</div>
</div>
<div class="counter">我是王小二的三儿子</div>
</div>
</div>
<div class="counter">我是王小三</div>
<div class="counter">我是王小四
<div class="reset">
<div class="counter">我是王小四的大儿子</div>
</div>
</div>
</div>
  • 图标

    这里的图标不是说图片,是画出来的一些图标, 播放图标demo
<style>
body{
background-color:#000
}
.focus__play {
position: relative;
display: inline-block;
width: 1.8rem;
height: 1.8rem;
border: .1rem solid;
border-radius: 999px;
}
.c_ico1 {
color: #fff;
}
.focus__play:before {
content: "";
position: absolute;
top: .5rem;
left: .65rem;
height: 0;
border-color: transparent transparent transparent currentColor;
border-width: .45rem .75rem;
border-style: solid;
}
</style>
<div class="inlineblock operation">
<a class="focus__play c_ico1 js_playallsong">
<span data-v-c9f6f162="" class="focus__play_text"></span>
</a>
</div>

CSS3的content属性详解

css counter计数器

CSS content换行技术实现字符animation loading效果

CSS计数器+伪类实现数值动态计算与呈现

ASCII码对照表

CSS quotes 属性

HTML <q> 标签

CSS Content 属性的更多相关文章

  1. #学习记录#——CSS content 属性

    CSS content 属性常结合:before 和:after 这两个伪类一起使用,给指定的元素添加内容来丰富页面. 1. 添加文本内容 html: <h1>给末尾添加内容. </ ...

  2. css content属性

    content 属性与 :before 及 :after 伪元素配合使用,来插入生成内容. 用于定义元素之前或之后放置的生成内容.默认地,这往往是行内内容,不过该内容创建的框类型可以用属性 displ ...

  3. 知道css有个content属性吗?有什么作用?有什么应用?

    css的content属性专门应用在 before/after 伪元素上,用来插入生成内容.最常见的应用是利用伪类清除浮动. //一种常见利用伪类清除浮动的代码 .clearfix:after { c ...

  4. CSS content换行技术实现字符animation loading效果

    一.之前我的字符loading实现 关于字符打点动画实现,我之前使用过box-shadow模拟,还有border+background模拟,还有使用text-shadow实现,以及今年自认为是最好的实 ...

  5. CSS魔法堂:一起玩透伪元素和Content属性

    前言  继上篇<CSS魔法堂:稍稍深入伪类选择器>记录完伪类后,我自然而然要向伪元素伸出"魔掌"的啦^_^.本文讲讲述伪元素以及功能强大的Contet属性,让我们可以通 ...

  6. CSS中content属性的妙用

    前言 本文讲解CSS中使用频率并不高的content属性,通过多个实用的案例,带你由浅入深的掌握content的用法,让代码变得更加简洁.高效. 定义 W3school中这样定义: content 属 ...

  7. css content 的 attr 用法 (实现悬浮提示)

    content 的attr 实现 鼠标悬浮 显示 悬浮提示, content 属性与 :before 及 :after 伪元素配合使用,来插入生成内容. 方法/步骤 1 <div> < ...

  8. css之属性及剩余的选择符

    今天的课程加速了,比平时快了些,但觉得很不错.nice~ 属性选择符 E[att]       选择具有att属性的E元素. input[type]{color: #red;} <input t ...

  9. css3 的content 属性

    content属性想必大家都熟悉了,一般结合伪类一起使用,表示显示的内容 例如:.box:before{content:"hello";width:100px;line-heigh ...

随机推荐

  1. 从Windows迁移SQL Server到Linux

    前一篇博客关于SQL Server on Linux的安装,地址:http://www.cnblogs.com/fishparadise/p/8057650.html,现在测试把Windows平台下的 ...

  2. 使用背景图修改radio、checkbox样式

    如果觉得设置样式太麻烦,或者页面上选中的样式太复杂,也可以用背景图去修改样式<div class=""> <label><input type=&qu ...

  3. Caffe-5.2-(GPU完整流程)训练(依据googlenet微调)

    上一篇使用caffenet的模型微调.但由于caffenet有220M太大,測试速度太慢.因此换为googlenet. 1. 训练 迭代了2800次时死机,大概20分钟. 使用的是2000次的模型. ...

  4. 【leetcode】123. Best Time to Buy and Sell Stock III

    @requires_authorization @author johnsondu @create_time 2015.7.22 19:04 @url [Best Time to Buy and Se ...

  5. iKcamp团队制作|基于Koa2搭建Node.js实战(含视频)☞ 路由koa-router

    路由koa-router--MVC 中重要的环节:Url 处理器

  6. maven安装配置及使用maven创建一个web项目

    今天开始学习使用maven,现在把学习过程中的资料整理在这边. 第一部分.maven安装和配置. http://jingyan.baidu.com/article/295430f136e8e00c7e ...

  7. CS:APP3e 深入理解计算机系统_3e C Programming Lab实验

    queue.h: /* * Code for basic C skills diagnostic. * Developed for courses 15-213/18-213/15-513 by R. ...

  8. cs231n --- 1:线性svm与softmax

    cs231n:线性svm与softmax 参数信息: 权重 W:(D,C) 训练集 X:(N,D),标签 y:(N,1) 偏置量bias b:(C,1) N:训练样本数:  D:样本Xi 的特征维度, ...

  9. ios 中的循环引用问题及解决

    循环引用,指的是多个对象相互引用时,使得引用形成一个环形,导致外部无法真正是否掉这块环形内存.其实有点类似死锁. 举个例子:A->B->C->....->X->B   - ...

  10. C++ 头文件系列(iostream)

    1. 简介 这个头文件非常特殊,它只声明了8个常用流对象. 2. 8个对象 2.1 窄字符对象(char) extern istream cin extern ostream cout extern ...