当前位置: 首页 > news >正文

CSS的 text-decoration

text-decoration

text-decoration CSS 简写属性设置文本上的装饰性线条的外观。它是 text-decoration-linetext-decoration-colortext-decoration-style 和较新的 text-decoration-thickness 属性的缩写。

MDN text-decoration

text-decoration 可以设置1到4个参数, 允许不分先后, 分别为:

  • line划线种类 text-decoration-line
  • color划线颜色 text-decoration-color
  • style划线样式 text-decoration-style
  • thickness划线厚度 text-decoration-thickness

text-decoration-line
  • none 无修饰。
  • overline 上划线。
  • line-through 中划线, 有一条贯穿文本中间的修饰线。
  • underline 下划线。

在这里插入图片描述


text-decoration-color

设置划线颜色

text-decoration-color:red; text-decoration-line:underline
可写成, 不分前后
text-decoration: red underline;

在这里插入图片描述


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

在这里插入图片描述


text-decoration-thickness

文本装饰线厚度 (粗细)
CSS 属性 text-decoration-thickness 用于设置元素中文本所使用的装饰线(如 line-through、underline 或 overline)的笔触厚度。
取值:

  • auto : 由浏览器为文本装饰线选择合适的厚度。
  • from-font : 如果字体文件中包含了首选的厚度值,则使用字体文件的厚度值。如果字体文件中没有包含首选的厚度值,则效果和设置为 auto 一样,由浏览器选择合适的厚度值。
  • 长度, 如 1em , 2px,
  • 百分比, 如 10%
/* Single keyword */
text-decoration-thickness: auto;
text-decoration-thickness: from-font;/* 长度*/
text-decoration-thickness: 0.1em;
text-decoration-thickness: 3px;/* 百分比*/
text-decoration-thickness: 10%;

可以写在text-decoration 四个参数位置的任意位置

在这里插入图片描述

在这里插入图片描述

Html去除a标签的默认样式,

a标签超链接字体默认蓝色带下划线;
去除可用:

a{text-decoration:none;color:inherit;cursor:auto;
}

测试代码

<!DOCTYPE html>
<html lang="zh-CN" dir="ltr"><head><meta charset="utf-8"/><title>Ctrl ae uk ak Bash</title><style id="Style001">a{text-decoration:none;color:inherit;cursor:auto;
}</style></head><body><div><a>这是一个a标签, 去掉a标签的样式, 用了👇</a><a></a><script>const Style001 = document.getElementById("Style001");document.currentScript.previousElementSibling.innerHTML = '<pre style="font-size:66px;">' + document.getElementById("Style001").innerHTML + '</pre>';</script>
</div></body></html>

效果

在这里插入图片描述

相关文章:

  • 八大排序浅入浅出
  • Instagram APIj接口——快速获取Ins帖子媒体内容下载链接
  • python脚本获取本机IP的方式
  • Flume基础教程
  • 使用python下载图片且批量将图片插入word文档
  • 如何设置MySQL远程访问权限?
  • [学习笔记]-MyBatis-Plus简介
  • Minillama3->dpo训练
  • OCR识别
  • 【IEEE独立出版、有确定的ISBN号】第三届能源与电力系统国际学术会议 (ICEEPS 2024)
  • php百度云账户余额查询API示例
  • 文件操作<C语言>
  • 【Ruby爬虫01】某吃瓜网站图片数据采集
  • 全面理解-Flutter(万字长文,深度解析)
  • Java中的编译时与运行时注解
  • iOS动画编程-View动画[ 1 ] 基础View动画
  • isset在php5.6-和php7.0+的一些差异
  • Iterator 和 for...of 循环
  • Linux中的硬链接与软链接
  • Mac转Windows的拯救指南
  • Odoo domain写法及运用
  • php的插入排序,通过双层for循环
  • puppeteer stop redirect 的正确姿势及 net::ERR_FAILED 的解决
  • SQLServer之创建数据库快照
  • 初探 Vue 生命周期和钩子函数
  • 从零开始在ubuntu上搭建node开发环境
  • 高性能JavaScript阅读简记(三)
  • 来,膜拜下android roadmap,强大的执行力
  • 人脸识别最新开发经验demo
  • 正则学习笔记
  • nb
  • 阿里云服务器如何修改远程端口?
  • ​【原创】基于SSM的酒店预约管理系统(酒店管理系统毕业设计)
  • ![CDATA[ ]] 是什么东东
  • # Apache SeaTunnel 究竟是什么?
  • #QT(QCharts绘制曲线)
  • (2)MFC+openGL单文档框架glFrame
  • (52)只出现一次的数字III
  • (代码示例)使用setTimeout来延迟加载JS脚本文件
  • (附程序)AD采集中的10种经典软件滤波程序优缺点分析
  • (附源码)基于SSM多源异构数据关联技术构建智能校园-计算机毕设 64366
  • (七)Java对象在Hibernate持久化层的状态
  • (四)Android布局类型(线性布局LinearLayout)
  • (原)Matlab的svmtrain和svmclassify
  • (转)关于如何学好游戏3D引擎编程的一些经验
  • .net 4.0发布后不能正常显示图片问题
  • .Net Web项目创建比较不错的参考文章
  • .net分布式压力测试工具(Beetle.DT)
  • .NET国产化改造探索(一)、VMware安装银河麒麟
  • .sdf和.msp文件读取
  • .sh
  • /dev/sda2 is mounted; will not make a filesystem here!
  • ??如何把JavaScript脚本中的参数传到java代码段中
  • @RequestMapping处理请求异常
  • @SuppressWarnings注解