css中添加中划线样式是什么

WBOY
WBOY原创
2021-12-29 11:59:132424浏览

在css中,可以利用“text-decoration:line-through”样式给文本元素添加中划线,“text-decoration”属性用于规定添加到文本的修饰,当属性值设置为“line-through”时用于定义穿过文本的中划线。

本教程操作环境:windows10系统、CSS3&&HTML5版、Dell G3电脑。

css中添加中划线样式是什么

text-decoration 属性规定添加到文本的修饰,下划线、上划线、删除线等。

当属性值设置为line-through时,定义穿过文本下的一条线。也就是中划线。

语法为:

text-decoration:line-through

示例如下:

<html>
<head>
<meta charset="utf-8"> 
<title>123</title> 
<style>
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
</style>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
</body>
</html>

输出结果:

04.png

(学习视频分享:css视频教程

以上就是css中添加中划线样式是什么的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
上一条:html有几个版本下一条:html5能做app吗