Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between & lt;br> and & lt;p> tags

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "

with

What are the differences between labels? The content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn together.

with

What is the difference between this article and the label?

I. Comprehensive introduction br p - TOP

First of all, the similarities are that br and p both have newline attributes and meanings.

Second, the difference is that only one is needed for separate use, while

and

is a pair of uses

Again, br labels are small newline references, p labels are large newline (segmented) line effects.

Br example, especially note that the web standard for br is, and if you use

No "/" although the effect is the same, but does not meet the w3c standard.

this is

Tag example, you can see that the use of html p tag is replaced by a large line, there is a blank line style.

When css styles are not set for p, a

The paragraph tag effect is equivalent to using two newline tags.

Description as shown in the following schematic diagram:

The diagram above shows exactly two br labels equal to one p instance

What you need to pay attention to when using p tags is what you need to pay attention to

and

Is a pair of use, see the above legend can understand and understand.

Of course, you can make p label newlines the same as br newlines without blanks. You can use css to set the corresponding p label margin:0; padding:0; to achieve this. Example p{ margin:0; padding:0;}, you can achieve this.

Equal to one.

The above is div css net to give you a popular introduction br"and p"

"Label usage.

Html p and br difference usage knowledge article

P and Br both have a line feed effect, p tags are paragraph tags, br is a forced line feed tag.

Related html knowledge- TOP

1、html p

2、html br

III.

And label difference- TOP

P is using a pair

Combination label, br independent a closed label.

1. Introduction to P paragraph tags

We can use the p tag for both the upper paragraph and the lower paragraph. We use the p tag before the beginning of a paragraph

Add one at the end of this paragraph.

Labels. The paragraph p tag will set the upper paragraph at a distance from the text below, about twice the line-height distance.

Screenshot of case effect:

p Tags Demo Screenshot

2. Br forced line tag introduction

Different from p paragraph tag, br tag is used for text paragraph newline typesetting. The distance between upper and lower lines of text after newline is realized by line-height line height.

html forced line tag demo screenshot

Usually under the same initialization of the web page, to achieve the same text spacing, 2 br newline tags are equivalent to using p paragraph tags.

P vs. br Tags Comparison Use Case Screenshot

html p and html br tag comparison screenshot

Html P paragraph vs. html Br newline comparison case HTML snippet:

The first line of text www.. com Second line of text Third line of text Fourth line of text

First paragraph

Second paragraph

Third paragraph

IV. Br and p Summary- TOP

We need small text line breaks when we use br line breaks tag, if you want to achieve paragraphs can use p tag, so that HTML structure is clear and conducive to search engines and users to read articles, appropriate paragraph and line break layout should be read habits from users.

And that's "

with

What are the differences between tags?"Thank you for reading all the contents of this article! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report