当前位置:网站首页>实现改变一段文字的部分颜色效果
实现改变一段文字的部分颜色效果
2022-07-29 06:04:00 【浮桥】
实现改变一段文字的部分颜色效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>伪类实现改变一段文字的部分颜色</title>
<style> .hf {
display: inline-block; font-size: 80px; line-height: 80px; color: #000; position: relative; overflow: hidden; whitewater-space: pre; /* 处理空格 */ } .hf:before {
position: absolute; left: 0; top: 0; color: #f00; display: block; width: 30%; /*如果想变色一半文字,就设置50%*/ content: attr(data-content); /* 伪元素的动态获取内容 */ overflow: hidden; } </style>
</head>
<body>
<div>
<span class="hf" data-content="W">W</span>
<span class="hf" data-content="e">e</span>
<span class="hf" data-content="b">b</span>
<span class="hf" data-content="前">前</span>
<span class="hf" data-content="端">端</span>
</div>
</body>
</html>

边栏推荐
- 模拟卷Leetcode【普通】150. 逆波兰表达式求值
- 数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
- [CF1054H] Epic Convolution——数论,卷积,任意模数NTT
- 【技能积累】写邮件时的常用表达
- 实战!聊聊如何解决MySQL深分页问题
- Mutual conversion between Base64 and file
- Simulation volume leetcode [normal] 222. number of nodes of complete binary tree
- Share some tips for better code, smooth coding and improve efficiency
- 数据库多表查询 联合查询 增删改查
- 【技能积累】presentation实用技巧积累,常用句式
猜你喜欢

王树尧老师运筹学课程笔记 04 线性代数基础

Unity免费元素特效推荐

Connecting PHP 7.4 to Oracle configuration on Windows

王树尧老师运筹学课程笔记 10 线性规划与单纯形法(关于检测数与退化的讨论)

Cvpr2022oral special series (I): low light enhancement

MySQL:当你CRUD时BufferPool中发生了什么?十张图就能说清楚

Ali gave several SQL messages and asked how many tree search operations need to be performed?

Flink实时仓库-DWD层(流量域)模板代码

How to write controller layer code gracefully?

10道面试常问JVM题
随机推荐
5g service interface and reference point
Database multi table query joint query add delete modify query
基于C语言设计的学籍管理系统
Teacher Wu Enda's machine learning course notes 00 are written in the front
Pod基本介绍
Ali gave several SQL messages and asked how many tree search operations need to be performed?
模拟卷Leetcode【普通】150. 逆波兰表达式求值
Summary of 2022 SQL classic interview questions (with analysis)
新同事写了几段小代码,把系统给搞崩了,被老板爆怼一顿!
2022年SQL经典面试题总结(带解析)
Teacher wangshuyao's notes on operations research 06 linear programming and simplex method (geometric significance)
MVFuseNet:Improving End-to-End Object Detection and Motion Forecasting through Multi-View Fusion of
Google fragmented notes JWT (Draft)
Unity免费元素特效推荐
Relative date used by filter in salesforce
SDN topology discovery principle
Teacher wangshuyao's notes on operations research course 10 linear programming and simplex method (discussion on detection number and degradation)
The difference between pairs and ipairs
Jetpack Compose 中的键盘处理
Teacher Wu Enda's machine learning course notes 03 review of linear algebra