css - 有什么方法可以为css中的文本下划线增加权重?
问题描述
我有这段代码,我想为我的弯曲文本下划线增加重量,因为它太薄而实际上没有明显的影响。我读过关于使用border-bottom 来增加重量,但是我不能让它弯曲。有没有人对如何解决这个问题有任何想法?
.underline-yellow{
text-decoration: underline;
text-decoration-color: #FFBE00;
text-decoration-style: wavy;
padding-bottom:2px;
color: black;
}
解决方案
如果不更改字体属性,就无法设置文本下划线粗细。
您可以玩弄background-image
并制作一种波浪形的样式。
body {
background: #ccc;
}
.underline-yellow{
color: black;
background-image: linear-gradient(45deg, transparent 65%, yellow 80%, transparent 90%), linear-gradient(135deg, transparent 5%, yellow 15%, transparent 25%), linear-gradient(135deg, transparent 45%, yellow 55%, transparent 65%), linear-gradient(45deg, transparent 25%, yellow 35%, transparent 50%);
background-repeat: repeat-x;
background-size: 20px 5px;
background-position: 0 100%;
padding-bottom: 3px;
}
<span class="underline-yellow">My decorated text</span>
推荐阅读
- c# - 将 DataGrid 保存到 Bin
- python - 连接 Matplotlib ListedColormap 值以匹配指定值
- c++ - 从字符串中删除计数大于或等于突发长度的相邻重复项
- php - PHPMailer 适用于来自本地主机的请求,但不适用于来自我机器外部的请求
- node.js - 使用 .get() 时变量未定义
- mongodb - Spring Boot Reactive MongoDB API with GraphQL - “Java 类不是列表或泛型类型信息丢失”
- css - css变换旋转闪烁/不工作
- python - 为什么图像没有在 Html 模板中呈现,甚至被添加到静态文件 - Django?
- java - 用于 websphere 的 Was_public.jar 和 j2ee.jar
- reactjs - 在嵌套路由中找不到页面