目录
HTML 中的文本装饰如何工作?
HTML 文本修饰示例
示例 #1 – 无
示例 #2 – 下划线
示例 #3 – 上划线
示例 #4 – 直通
示例#5
结论
首页 web前端 html教程 HTML 文本装饰

HTML 文本装饰

Sep 04, 2024 pm 04:40 PM
html html5 HTML Tutorial HTML Properties HTML tags

HTML 中的文本装饰,用于以不同方式装饰文本。 text-decoration 是用于文本装饰的属性。 text-decoration 属性采用下划线、上划线、穿行线、下划线上划线值来以不同的方式装饰文本。

实时示例:文本装饰上划线、下划线、穿线值用于生成验证码,同时确认登录用户是人类还是机器人。因为如果机器人无法完美识别文本顶部的线条。

类型:

  • 文本装饰:无;
  • 文字装饰:上划线;
  • 文本修饰:换行;
  • 文字修饰:下划线;

HTML 中的文本装饰如何工作?

文本装饰属性基于无、上划线、穿线和下划线

1。无

语法:

text-decoration: none;
登录后复制

说明:它不会给文本带来任何装饰。就像普通文本一样。

2。上划线

语法:

text-decoration: overline;
登录后复制

说明:它会在文本顶部给出一条 1px 大小的线。

3。直通

语法:

text-decoration: line-through;
登录后复制

说明:它将给出从文本中间开始的1px大小的线条。

4。下划线

语法:

text-decoration: underline;
登录后复制

说明:它会在文本底部给出一条 1px 大小的线。

5。眨眼

语法:

text-decoration: blink;
登录后复制

说明:它会让文字以不同颜色闪烁,透明度从0%到100%。

注意: 最新浏览器的闪烁功能已被弃用。现在根本不用了。

Text-decoration属性还可以用颜色制作除默认样式之外的上划线、穿线、下划线等不同样式的点线、波浪线、实线、凹槽等。您可以看到以下语法。

语法:

text-decoration: underline dotted red;
登录后复制

HTML 文本修饰示例

以下是 HTML 文本装饰的示例:

示例 #1 – 无

代码:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.none {
text-decoration: none;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:none</h1>
<p class="none">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in the development of back end features in Spring MVC with Hibernate. Developed importing models and logic in the Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登录后复制

输出:

HTML 文本装饰

说明:如您所见,text-decoration: none 不能为段落文本提供任何线条装饰。

示例 #2 – 下划线

代码:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.underline {
text-decoration: underline;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:underline</h1>
<p class="underline">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登录后复制

输出:

HTML 文本装饰

说明:如您所见,text-decoration: underline 给出了文本下方的线条。

示例 #3 – 上划线

文本修饰:上划线示例:

代码:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.overline{
text-decoration: overline;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:overline</h1>
<p class="overline">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登录后复制

输出:

HTML 文本装饰

说明:如您所见,text-decoration: overline 在文本上方给出线条。

示例 #4 – 直通

文本装饰:穿线示例:

代码:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.through {
text-decoration: line-through;
font-size:20px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:line-through</h1>
<p class="through">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登录后复制

输出:

HTML 文本装饰

说明:如您所见,text-decoration: line-through 从文本中间给出线条。

示例#5

带有实线、双线、波浪线、下划线、下划线、上划线的文本装饰示例:

代码:

<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align:center;
color:green;
}
.p1 {
text-decoration:solid overline brown;
font-size:18px;
}
.p2 {
text-decoration:double line-through blue;
font-size:18px;
}
.p3 {
text-decoration:wavy underline red;
font-size:18px;
}
}
</style>
</head>
<body>
<h1>Demo for text-decoration:solid overline brown</h1>
<p class="p1">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
<h1>Demo for text-decoration:double line-through blue</h1>
<p class="p2">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
<h1>Demo for text-decoration:wavy underline red</h1>
<p class="p3">
Executed and contributed to full-stack web development projects, with an emphasis on front end
features, browser manipulation, and cross-browser compatibility. Wrote templates and front-end code for ECM app to meet WebTop application compatibility.
Assisted in development of back end features in Spring MVC with Hibernate. Developed importing models and logic in Office Note app to store spreadsheet data and deployed
to host.
</p>
</body>
</html>
登录后复制

输出:

HTML 文本装饰

说明:如您所见,第一段有实线上划线,第二段有双下划线,第三段有波浪下划线文本装饰样式。

结论

文本装饰可以通过上划线、下划线、穿线属性值以及任何颜色的不同线条样式进行样式化。

以上是HTML 文本装饰的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

热门话题

Java教程
1653
14
CakePHP 教程
1413
52
Laravel 教程
1304
25
PHP教程
1251
29
C# 教程
1224
24
HTML 中的表格边框 HTML 中的表格边框 Sep 04, 2024 pm 04:49 PM

HTML 表格边框指南。在这里,我们以 HTML 中的表格边框为例,讨论定义表格边框的多种方法。

HTML 中的嵌套表 HTML 中的嵌套表 Sep 04, 2024 pm 04:49 PM

这是 HTML 中嵌套表的指南。这里我们讨论如何在表中创建表以及相应的示例。

HTML 左边距 HTML 左边距 Sep 04, 2024 pm 04:48 PM

HTML 左边距指南。在这里,我们讨论 HTML margin-left 的简要概述及其示例及其代码实现。

HTML 表格布局 HTML 表格布局 Sep 04, 2024 pm 04:54 PM

HTML 表格布局指南。在这里,我们详细讨论 HTML 表格布局的值以及示例和输出。

HTML 输入占位符 HTML 输入占位符 Sep 04, 2024 pm 04:54 PM

HTML 输入占位符指南。在这里,我们讨论 HTML 输入占位符的示例以及代码和输出。

HTML 有序列表 HTML 有序列表 Sep 04, 2024 pm 04:43 PM

HTML 有序列表指南。在这里我们还分别讨论了 HTML 有序列表和类型的介绍以及它们的示例

HTML onclick 按钮 HTML onclick 按钮 Sep 04, 2024 pm 04:49 PM

HTML onclick 按钮指南。这里我们分别讨论它们的介绍、工作原理、示例以及各个事件中的onclick事件。

在 HTML 中移动文本 在 HTML 中移动文本 Sep 04, 2024 pm 04:45 PM

HTML 中的文本移动指南。在这里我们讨论一下marquee标签如何使用语法和实现示例。

See all articles