Home > Article > Web Front-end > Is the html p tag a single tag? Introduction to the use of html p tag (example included)
This article mainly introduces the specific usage and some functions of the p tag in HTML. There are examples to explain. Next, let us take a look at this article about the html P tag. Article
First let’s take a look at the html p tag. Is it a single tag?
When you hear this question, you will know that it is a novice who has not used HTML very much, or has never heard of it, because the HTML p tag is one of the most common tags in HTML, including paragraph tags and block-level elements. , is the general introduction of the P tag, starting with
and ending with
. All the text filled in the tag is a piece of text in the browser. display. (If you want to see more, come to PHP Chinese website HTML online course)Let’s look at examples now and explain along the way:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>PHP中文网</title> </head> <body> <p>这里是PHP中文网,这里提供了大量的免费,原创、高清的视频教程,在学习的时候可以直接在线实战。</p><p>这里是PHP中文网, 欢迎你的到来</p> </body> </html>
I added two paragraphs here, with two P tags. The display effect on the web page is as follows:
So let’s not say that P tags appear in pairs. , if you forget the end, the effect will not be readable, and the browser can display it normally, but this violates the provisions of the w3c standard. Also, if you make an error in the browser, in the end you find that it is just How unfair it is that the P tag does not have an end. Therefore, it is better to write the P tag properly and don’t forget to end the tag.
Look again, because the P tag is a block-level element, block-level elements are displayed in a paragraph break in the web page, which is a little different from line break. Normally speaking, line break is also OK, but we must do it formally. There is a line break tag, and its tag is . Yes, this is an element without an end tag. Generally, if there are too many lines in one line, the br tag will appear after that line, and then the following text will be displayed on the next line. Now let’s look at the example
<body> <p>这里是PHP中文网,这</br>里提供了大量的免费,原创、高清的视频教程,在学习的时候可以直接在线实战。</p>这里是PHP 中文网,欢迎你的到来</p> </body>
. A br line break tag is added in the middle. Let’s Let's take a look at the effect:
As shown in the picture, I added a br tag in the middle of "here". We can see that there is no more behind the br. This line is This frees up the space. So usually, there is a lot of text in a paragraph, and we often need to highlight some text. In addition to bolding and italics, we can also try line breaks to make the text highlighted. Can a few words in one line not be highlighted? .
html Summary of the p tag:
The P tag is mainly used in the
tag. Like the news page, it is all paragraphs, so it will be used here. There are many P tags, and many elements can be added to the P tag. I won’t go into them one by one here. The result is that the P tag is one of the indispensable elements in HTML web pages. It has many uses, but the specific Other tags are also needed to assist the beauty and globality of this tag.Okay, the above is the entire content of this article. If you have any questions, you can ask them below.
【Editor's Recommendation】
How to use the insert text ins tag and delete text del tag together in HTML? (With examples)
#What is the html h1 tag? Detailed introduction to the use of html h1 tag
The above is the detailed content of Is the html p tag a single tag? Introduction to the use of html p tag (example included). For more information, please follow other related articles on the PHP Chinese website!