作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
text-decoration-color
似乎没有得到足够广泛的支持。
我试过这个:
.underline {
position: relative;
}
.underline:after {
position: absolute;
content: '';
height: 1px;
background-color: #ffc04d;
bottom: .1rem;
right: 0;
left: 0;
z-index: -1;
}
<h1><span class="underline">Sprouted Bread</span></h1>
最佳答案
线性渐变怎么样,它可以很容易地控制单个元素内的颜色、大小和距离:
.underline {
position: relative;
font-size:28px;
background:
linear-gradient(yellow,yellow) /* Color */
left 0 bottom 2px/ /* Position */
100% 2px /* Size (width height)*/
no-repeat;
}
<div style="width:150px;text-align:center"><span class="underline">Sprouted Bread</span></div>
作为旁注,border-bottom 与 inline element 一起使用效果很好,但当然您不能轻易控制距离以使其表现为文本装饰:
.underline {
position: relative;
font-size:28px;
border-bottom:2px solid yellow;
}
<div style="width:150px;text-align:center"><span class="underline">Sprouted Bread</span></div>
关于html - CSS中易碎的彩色下划线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49395466/
它在 Java 中的样子: public void perform() { outer: while (someCondition) { while(someCollectio
我是一名优秀的程序员,十分优秀!