Home  >  Article  >  Web Front-end  >  How to add strikethrough to text in html? Two methods to add strikethrough (example)

How to add strikethrough to text in html? Two methods to add strikethrough (example)

青灯夜游
青灯夜游Original
2018-10-09 11:53:5218934browse

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:

How to add strikethrough to text in html? Two methods to add strikethrough (example)

##As shown in the example, as long as you add the text in the tag, you can achieve what you want Effect. The tag can be abbreviated to the tag, with the same effect.

Netscape and Internet Explorer both support these two writing methods.

Note: The tag ( tag) is deprecated in HTML 4 and XHTML, which means it is no longer used; sooner or later it will disappear.

It is generally recommended not to use the tag, but to use the tag to achieve the strikethrough effect. Let’s introduce the html tag.

html Tag

Tag defines text that has been deleted in the document.

<!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 to text in html? Two methods to add strikethrough (example)

As shown in the example, the use of tag is the same as the tag easy and convenient. And all major browsers support the tag.

Note: Please use it with the tag to describe updates and corrections in the document.

Summary: The above is the entire content of this article. In fact, in addition to using the above two methods to add strikethrough, you can also use css to achieve strikethrough and set the strikethrough style at the same time. Follow-up article [

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:

php public welfare training video tutorial

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn