CSS文本划线效果(text-decoration相关属性详解)
创作时间:
作者:
@小白创作中心
CSS文本划线效果(text-decoration相关属性详解)
引用
CSDN
1.
https://blog.csdn.net/qq_52395343/article/details/140374707
/* 样式类型*/
text-decoration: underline;
/* 下划线颜色 */
text-decoration-color: #ffcb15;
/* 超出基线的字符不会被截断 */
text-decoration-skip-ink: none;
/*下划线厚度 */
text-decoration-thickness: 5px;
/* 与其原始位置的偏移距离 */
text-underline-offset: 0;
1. text-underline-offset
使用 text-decoration 时,设置文本装饰下划线与其原始位置的偏移距离。
具体用法:
/* auto: 浏览器为下划线选择适当的偏移量*/
text-underline-offset: auto;
/* length:指定下划线偏移量 */
text-underline-offset: 0.1em;
text-underline-offset: 3px;
/* 百分比*/
text-underline-offset: 20%;
/* 全局值 */
text-underline-offset: inherit;
text-underline-offset: initial;
text-underline-offset: revert;
text-underline-offset: revert-layer;
text-underline-offset: unset;
注意:该属性不是 text-decoration 的简写属性!
2. text-decoration
设置文本上的装饰性线条的样式。该属性是 text-decoration-color、text-decoration-line、text-decoration-style、text-decoration-thickness 的简写属性。
- text-decoration-line:设置文本修饰线的类型,
underline(在文本的下方)、overline(在文本的上方)、line-through(贯穿文本中间) - text-decoration-style: 设定的线的样式,
solid(直线)、double(双下划线)、dotted(点画线)、dashed(虚线)、wavy(波浪线) - text-decoration-color:设置文本修饰线的颜色
- text-decoration-thickness:设置文本修饰线的厚度
text-decoration: underline wavy red;
text-underline-offset: 3px;
3. text-decoration-skip-ink
设置如何绘制超出基线的字符。默认值为 auto 下,超出基线的字符浏览器会进行截断;设置为 none,会直接穿过字体的超出部分,不会被截断:
text-decoration: underline red;
text-decoration-skip-ink: none;
热门推荐
吉祥馄饨的万能麻酱蘸料,好吃到停不下来!
芝麻酱:火锅蘸料界的营养王者
冬季必备:北派火锅芝麻酱蘸料大揭秘!
《大青树下的小学》:乡村教育的新希望
脂肪组织竟是断崖式衰老的“罪魁祸首”?
最新研究:通过饮食干预延缓“断崖式衰老”
《熊出没》:孩子成长的秘密武器?
《熊出没》动画制作揭秘:从2D到3D的技术跨越
用《熊出没》培养孩子的语言表达力
技术有爱,公益无界——“CCF公益日”启动!
猪脚醋也叫猪脚姜,老广的正宗做法不加一滴水,软糯弹牙香气扑鼻
科学饮食防白发,维生素大显神威!
中医调理白发有妙方:从食疗到日常养护全攻略
北京清华长庚医院揭秘:白发真相大起底!
别人给你发新年祝福,别只会说“新年快乐”,高情商的人这样回复
高考复读如何提高学习效率?
B站春晚上那些令人难忘的影视瞬间:肖战、蔡徐坤、迪丽热巴
B站上线42年春晚引发怀旧潮,迪丽热巴新疆舞惊艳全网
秋冬养生必备:自制无添加橙汁
央视曝光:橙汁添加剂或影响儿童智力发育
用PyCharm打造火爆休闲小游戏
苏杭沪四日游:网红打卡全攻略!
长三角必打卡!拙政园、西湖、外滩全攻略
冬日江南游:西湖、乌镇、唐寅园必打卡!
浅充浅放,让电池更长寿!
揭秘锂聚合物电池:正确充电姿势全攻略
二甲双胍缓释片:晚餐后服用更控糖?
同里湿地公园:生态与文化共舞
同里湿地公园:自然课堂里的鸟儿天堂
同里湿地公园一日游打卡攻略:自然与人文的完美融合