text-decoration 使用

text-decoration

text-decoration 用于设置文本上的装饰性线条的外观。

它是 text-decoration-linetext-decoration-styletext-decoration-colortext-decoration-thickness的缩写。

text-decoration: underline wavy red;

text-decoration-line 设置文本装饰类型

可以设置为none,或者多个下列的值。

  • none: 没有装饰效果,默认值
  • underline: 文本下方有一条装饰线
  • overline:文本上方有装饰线
  • line-through:有一条贯穿文本中间的修饰线
text-decoration-line: none;
text-decoration-line: underline;
text-decoration-line: overline;
text-decoration-line: line-through;
text-decoration-line: blink;
text-decoration-line: underline overline; /* Two decoration lines */
text-decoration-line: overline underline line-through; /* Multiple decoration lines */

text-decoration-style 设置线的样式

  • solid: 实线
  • double: 双实线
  • dotted:点线
  • dashed: 虚线
  • wavy:波浪线
text-decoration-style: solid;
text-decoration-style: double;
text-decoration-style: dotted;
text-decoration-style: dashed;
text-decoration-style: wavy;

text-decoration-color 设置修饰线的颜色

默认值为当前文本的颜色

/* Initial value */
text-emphasis-color: currentcolor;

/* <color> */
text-emphasis-color: #555;
text-emphasis-color: blue;

text-decoration-thickness 文本装饰线厚度 (粗细)

  • auto: 由浏览器为文本装饰线选择合适的厚度
  • from-font: 如果字体文件中包含了首选的厚度值,则使用字体文件的厚度值。如果字体文件中没有包含首选的厚度值,则效果和设置为 auto 一样,由浏览器选择合适的厚度值
  • <length>: 将文本装饰线的厚度设置为一个值,覆盖掉字体文件建议的值或浏览器默认的值。
  • <percentage>: 将文本装饰线的粗细指定为当前字体中 1em 的 <百分比>。 百分比作为相对值继承,因此会随着字体的变化而缩放。 浏览器必须至少使用 1 个设备像素。 对于此属性的给定应用程序,即使存在具有不同字体大小的子元素,其所应用的整个框的厚度也是恒定的。
text-decoration-thickness: auto;
text-decoration-thickness: from-font;
/* length */
text-decoration-thickness: 0.1em;
text-decoration-thickness: 3px;

/* percentage */
text-decoration-thickness: 10%;
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值