如何在 HTML 中標記已刪除的文字?


我們使用 <del> 標記在 HTML 中刪除文字。此標記對要從文件中刪除的文字標記刪除線。

我們還可以使用 style 屬性在 HTML 中刪除文字。style 屬性為元素指定內聯樣式。此屬性與 CSS 屬性 text-decoration 屬性一起在 HTML <p> 標記內使用。

語法

以下是刪除 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>

示例

在下面的示例中,我們在 <h1> 標記內的特定文字上使用了 <del> 標記。

<!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>

更新日期: 2022-11-11

1K+ 次瀏覽

開啟你的職業生涯

完成課程並獲得認證

開始
廣告
© . All rights reserved.