Home >Web Front-end >HTML Tutorial >How to add strikethrough to text in html? Two methods to add strikethrough (example)
I believe that when you browse the websites of major shopping malls, you will always see the original price mark of a certain product, and then add an obvious strikethrough to the original price to indicate that there is a promotion now, and the current price has been changed to what it is. Give users an intuitive sense of difference and attract users to buy! So how is such a strikethrough effect added to text text? This chapter will introduce to you two ways to add strikethrough to text in HTML. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
First of all, let’s take a look at the two methods of adding a strikethrough effect to text on an html page:
html The tag element implements a strikethrough effect on text. ;
html The label element realizes the effect of adding strikethrough to text;
Below we will introduce in detail how these two methods achieve the effect of adding strikethrough to text. By simply examples to introduce.
html Tag
Tag can be defined with strikethrough text definition.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>html <strike> 标签</title> </head> <body> <p><strike>这是测试代码,被删除了</strike></p> </body> </html>
Rendering:
##As shown in the example, as long as you add the text in thehtml Tag
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>html <del> 标签</title> </head> <body> <p>原价:<del>20</del>,现在促销价:10</p> </body> </html>Rendering:
How to add strikethrough in css? css text-decoration attribute setting strikethrough (code example) ] will introduce how to use css to set strikethrough style. I hope it will be helpful to everyone's learning. For more related tutorials, please visit HTML video tutorial!
Related recommendations:The above is the detailed content of How to add strikethrough to text in html? Two methods to add strikethrough (example). For more information, please follow other related articles on the PHP Chinese website!