如何在HTML中下划线文本?
下划线文本用于帮助吸引人们对文本的注意。
我们使用<u>标签在HTML中下划线文本。它表示网页内容中与其他文本不同的样式的文本。
我们也可以使用style属性在HTML中下划线文本。style属性指定元素的内联样式。此属性与HTML <p>标签一起使用,并使用CSS属性text-decoration属性。
语法
以下是HTML中下划线文本的语法。
<u>The content to be underlined</u>
示例
以下是HTML中下划线文本的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for <u>Delhi Land and Finance </u>. <br> Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>
示例
在下面的示例中,我们对<h1>元素内的文本进行了下划线。
<!DOCTYPE html> <html> <head> <title>HTML u tag</title> </head> <body> <h1><u>we are underlining the text inside the '<h>' element.</u></h1> </body> </html>
使用内联CSS下划线文本
使用CSS属性下划线文本。此属性在<p>标签内使用。
语法
以下是使用CSS属性下划线文本的语法。
<p style="text decoration:underline;">The content to be underlined</p>
示例
以下是使用CSS属性下划线文本的示例程序。
<!DOCTYPE html> <html> <head> </head> <body> <p>DLF stands for</p><p style="text-decoration:underline;">Delhi Land and Finance. </p> <p> Delhi Land and Finance is one of the largest commercial real estate developer in India.</p> </body> </html>
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP