css下划线样式设置

admin 轻心小站 关注 LV.19 运营
发表于前端技术学习版块 css,教程

CSS 下划线样式是网页设计中常用的一种样式设置方式。下面介绍几种设置下划线的方式。/* 实线下划线样式 */ .text { text-decoration: underline; } /* 虚线下

CSS 下划线样式是网页设计中常用的一种样式设置方式。下面介绍几种设置下划线的方式。

/* 实线下划线样式 */
.text {
  text-decoration: underline;
}

/* 虚线下划线样式 */
.text {
  text-decoration: underline dotted;
}

/* 双下划线样式 */
.text {
  text-decoration: underline double;
}

/* 点线下划线样式 */
.text {
  text-decoration: underline wavy;
}

/* 自定义下划线样式 */
.text {
  background-image: linear-gradient(to bottom, #f0f, #f0f);
  background-repeat: repeat-x;
  -webkit-background-size: 100% 5px;
  background-size: 100% 5px;
  background-position: bottom left;
  text-decoration: none;
  -webkit-text-decoration: underline;
  text-decoration-color: transparent;
  -webkit-text-decoration-color: transparent;
} 

在以上例子中,.text 代表一个文本元素。不同的 text-decoration 属性值可以设置不同的下划线样式。自定义下划线样式使用了背景图像和重复线性渐变的方式来实现。

文章说明:

本文原创发布于探乎站长论坛,未经许可,禁止转载。

题图来自Unsplash,基于CC0协议

该文观点仅代表作者本人,探乎站长论坛平台仅提供信息存储空间服务。

评论列表 评论
发布评论

评论: css下划线样式设置

粉丝

0

关注

0

收藏

0

已有0次打赏