CSS text-decoration 属性
AI 概述
属性定义及使用说明语法属性值浏览器支持实例 1实例 2相关文章
属性定义及使用说明
text-decoration 属性规定添加到文本的修饰,下划线、上划线、删除线等。
text-decoration 属性是以下三种属性的简写:
text-decoration-line
text-decoration-color
text-decoration-style
语法
/*关键值*/
text-d...
目录
属性定义及使用说明
text-decoration 属性规定添加到文本的修饰,下划线、上划线、删除线等。
text-decoration 属性是以下三种属性的简写:
语法
/*关键值*/ text-decoration: none; /*没有文本装饰*/ text-decoration: underline red; /*红色下划线*/ text-decoration: underline wavy red; /*红色波浪形下划线*/ /*全局值*/ text-decoration: inherit; text-decoration: initial; text-decoration: unset;
| 默认值: | none |
|---|---|
| 继承: | no |
| 版本: | CSS1 |
| JavaScript 语法: | object.style.textDecoration=”overline” |
属性值
| 值 | 描述 |
|---|---|
| none | 默认。定义标准的文本。 |
| underline | 定义文本下的一条线。 |
| overline | 定义文本上的一条线。 |
| line-through | 定义穿过文本下的一条线。 |
| blink | 定义闪烁的文本。 |
| inherit | 规定应该从父元素继承 text-decoration 属性的值。 |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
| 属性 | |||||
|---|---|---|---|---|---|
| text-decoration | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
实例 1
设置 h1,h2,h3 和 h4 元素文本装饰:
<style>
h1 {text-decoration:overline;}
h2 {text-decoration:line-through;}
h3 {text-decoration:underline;}
</style>
<body>
<h1>这是标题 1</h1>
<h2>这是标题 2</h2>
<h3>这是标题 3</h3>
</body>
效果如下:

实例 2
虚线与波浪线:
<style>
h1 {
text-decoration: underline overline dotted red;
}
h2 {
text-decoration: underline overline wavy blue;
}
</style>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<p><strong>注意:</strong>在 Edge/Internet 浏览器中没有效果。</p>
</body>
效果如下:

相关文章
CSS 教程: CSS Text 文本属性
以上关于CSS text-decoration 属性的文章就介绍到这了,更多相关内容请搜索码云笔记以前的文章或继续浏览下面的相关文章,希望大家以后多多支持码云笔记。
声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请将相关资料发送至 admin@mybj123.com 进行投诉反馈,一经查实,立即处理!
重要:如软件存在付费、会员、充值等,均属软件开发者或所属公司行为,与本站无关,网友需自行判断
码云笔记 » CSS text-decoration 属性
如若内容造成侵权/违法违规/事实不符,请将相关资料发送至 admin@mybj123.com 进行投诉反馈,一经查实,立即处理!
重要:如软件存在付费、会员、充值等,均属软件开发者或所属公司行为,与本站无关,网友需自行判断
码云笔记 » CSS text-decoration 属性
微信
支付宝