CSS Content 属性
content 属性,用在after,before伪元素上,用于在选中的元素前后插入内容。
插入的内容多种多样,
- 纯文字
h1::after{
content:"h1后插入内容"
}
- 文字符号
关于 quotes ,参考CSS quotes 属性
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 属性的更多相关文章
- #学习记录#——CSS content 属性
CSS content 属性常结合:before 和:after 这两个伪类一起使用,给指定的元素添加内容来丰富页面. 1. 添加文本内容 html: <h1>给末尾添加内容. </ ...
- css content属性
content 属性与 :before 及 :after 伪元素配合使用,来插入生成内容. 用于定义元素之前或之后放置的生成内容.默认地,这往往是行内内容,不过该内容创建的框类型可以用属性 displ ...
- 知道css有个content属性吗?有什么作用?有什么应用?
css的content属性专门应用在 before/after 伪元素上,用来插入生成内容.最常见的应用是利用伪类清除浮动. //一种常见利用伪类清除浮动的代码 .clearfix:after { c ...
- CSS content换行技术实现字符animation loading效果
一.之前我的字符loading实现 关于字符打点动画实现,我之前使用过box-shadow模拟,还有border+background模拟,还有使用text-shadow实现,以及今年自认为是最好的实 ...
- CSS魔法堂:一起玩透伪元素和Content属性
前言 继上篇<CSS魔法堂:稍稍深入伪类选择器>记录完伪类后,我自然而然要向伪元素伸出"魔掌"的啦^_^.本文讲讲述伪元素以及功能强大的Contet属性,让我们可以通 ...
- CSS中content属性的妙用
前言 本文讲解CSS中使用频率并不高的content属性,通过多个实用的案例,带你由浅入深的掌握content的用法,让代码变得更加简洁.高效. 定义 W3school中这样定义: content 属 ...
- css content 的 attr 用法 (实现悬浮提示)
content 的attr 实现 鼠标悬浮 显示 悬浮提示, content 属性与 :before 及 :after 伪元素配合使用,来插入生成内容. 方法/步骤 1 <div> < ...
- css之属性及剩余的选择符
今天的课程加速了,比平时快了些,但觉得很不错.nice~ 属性选择符 E[att] 选择具有att属性的E元素. input[type]{color: #red;} <input t ...
- css3 的content 属性
content属性想必大家都熟悉了,一般结合伪类一起使用,表示显示的内容 例如:.box:before{content:"hello";width:100px;line-heigh ...
随机推荐
- 自己定义View Controller转换动画
原文链接 : Introduction to Custom View Controller Transitions and Animations 原文作者 : joyce echessa 译文出自 : ...
- Lucene41PostingWriter源代码分析
原来看lucene4.0的posting格式(http://blog.csdn.net/jollyjumper/article/details/30017581),发现这还是比較简单的VInt格式,据 ...
- MyBatis_关联关系查询
一.关联查询 当查询的内容涉及到具有关联关系的多个表时,就需要使用关联查询.根据表与表间的关联关系的不同.关联查询分为四种: 一对一关联查询: 一对多关联查询: 多对一关联查询: 多对多关联查询: 二 ...
- 解决Unable to find setter method for attribute: [commandName]
最近学习springmvc的表单标签库,其中form标签主要用于渲染HTML表单,而form标签有很多属性,可供选择,其中一般来说(以前)最重要的是commandName属性,因为它定义了模型属性的名 ...
- SharePoint Framework 简介
作者:陈希章 发表于 2017年12月25日 前言 通过前面几篇文章,我相信大家对于SharePoint Online的开发有了更加全面的认识,上一篇 介绍的SharePoint Add-in的开发, ...
- EL表达式的简单实用
EL表达式 EL(Expression Language) 是为了使JSP写起来更加简单.表达式语言的灵感来自于 ECMAScript 和 XPath 表达式语言,它提供了在 JSP 中简化表达式的方 ...
- 系统自带vim命令学习教程
[环境] [干货分享] vim或者vi命令在很多linux环境中自带一款学习教程,其教程说明语言还是随系统变化. 输入vimtutor这个命令会打开一款学习神器. 打开之后显示如下,vimtutor一 ...
- MQTT 简介
MQTT 全称是 Message Queue Telemetry Transport,是一个轻量级的“发布/订阅”消息传输协议. 官网 http://mqtt.org/ 发布/订阅 MQTT 的基本概 ...
- Eclipse上Maven环境配置使用 (全)
Eclipse上Maven环境配置使用 (全) 1. 安装配置Maven: 1.1 从Apache网站 http://maven.apache.org/ 下载并且解压缩安装Apache Maven. ...
- iOS OC Swift3.0 TableView 中tableviewcell的线左边不到边界
Swift 3.0 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt index ...