首页 > 文章列表 > 如何在HTML中标记已删除的文本?

如何在HTML中标记已删除的文本?

211 2023-09-16

我们使用标签来删除HTML中的文本。该标签标记在要从文档中删除的文本上。

我们还可以使用 style 属性来删除 HTML 中的文本。 style 属性指定元素的内联样式。此属性在 HTML

标记内部与 CSS 属性 text-decoration 属性一起使用。

语法

以下是删除 HTML 中文本的语法。

<del> The content to be deleted </del>

示例

以下是删除HTML文本的示例程序。

<!DOCTYPE html>
<html>
<head>
</head>
<body>
   <p>DLF stands for<del>Delhi Land and Finance.</del></p>
   <p>Delhi Land and Finance is one of the largest commercial real estate developer in India.</p>
</body>
</html>

示例

在下面的示例中,我们在

标记内的特定文本上使用了 标记。

<!DOCTYPE html>
<html>
<head>
   <title>HTML u tag</title>
</head>
<body>
   <h1>Welcome to <del> Disney land </del> Kids.</h1>
</body>
</html>

通过内联 CSS 标记已删除的文本

使用CSS属性在HTML中删除文本。

语法

以下是使用CSS属性删除HTML中文本的语法。

<p style="text decoration:line-through;">The content to be underlined</p>

示例

以下是使用 CSS 属性删除 HTML 中文本的示例程序。

<!DOCTYPE html>
<html>
<head>
</head>
<body>
   <p>DLF stands for</p><p style="text-decoration:line-through;">Delhi Land and Finance</p>
   <p>Delhi Land and Finance is one of the largest commercial real estate developer in India.</p>
</body>
</html>