html - 使用html和css在同一文本中使用两种不同的颜色
问题描述
我想为我的文本设置两种不同的颜色。我的文字是短语 1 / 短语 2,我想将黑色设置为短语 1 / 将绿色设置为短语 2
<label class="diffcolor">pharse1/ phrase2</label>
我的例子
<label class="diffcolor">pharse1/ </label>
CSS:
.different::after{
color : green;
content :"phrase2";
}
我的 Internet Explorer 浏览器无法正常工作。我怎样才能做到这一点 ?
解决方案
label.class { color:#4C4C4C }
span.name { color:#FF0000; }
<label class="diffcolor">pharse1/ <span class="name">phrase2</span></label>
推荐阅读
- python - 数据框列表追加有问题
- telegram-bot - 在输入字段中显示附加 (/) 按钮?
- hibernate - Hibernate 不插入行而不是更新复合键的行
- python - 我需要使用 pyspa 根据另一列的条件创建新列
- javascript - 文档 javascript 的单独字符串
- android - 在 Android 应用中实现高亮把手和选择/复制/粘贴
- php - php group array 多维(最多第三级)
- python - 无法为 API 设置“DEFAULT_AUTHENTICATION_CLASSES”导入“rest_framework_simplejwt.auth.JWTAuthentication”
- operating-system - 谁能给我一个操作系统中使用的 VSWS 算法的高级概述?
- node.js - 在nestjs项目中运行dist文件时出错,请帮助我