" is a paragraph tag with an end tag, that is, "

" and "

" are used together; "
" is a forced line break tag, which is an empty tag and does not End tag, so "

" is written incorrectly. Compared with "
" and

", "

" has a larger line spacing."> What is the difference between <p> and <br> in HTML-HTML Tutorial-php.cn

What is the difference between

and
in HTML

青灯夜游
Release: 2021-03-02 10:48:03
Original
7844 people have browsed it

Difference: "

" is a paragraph tag with an end tag, that is, "

" and "

" are used together; "
" is mandatory The newline tag is an empty tag. It has no end tag, so the writing of "
" is wrong. Compared with "
" and

", "

" has a larger line spacing.

What is the difference between <p> and <br> in HTML

The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.

p tag

##

tag is a paragraph tag, used to define paragraphs.

The element will automatically create some white space before and after it. The browser will automatically add these spaces, and you can also specify it in the style sheet.

Usually in the article, there is a clear distinction between the paragraphs in the upper paragraph and the text in the previous paragraph. If there is a certain gap between the text in the next paragraph, we can use the p tag for both the upper and lower paragraphs. We use the p paragraph tag, use

before the beginning of a paragraph of text, and add a

tag at the end of the paragraph of text. Paragraph p The label will put a certain distance between the upper and lower paragraphs of text, about twice the line-height distance.

br Label


Yes A forced line break tag that inserts a simple newline character. The


tag is an empty tag (meaning it has no closing tag, so this is an error:
). In XHTML, put the end tag in the start tag, that is
.

Different from the p paragraph tag, the br tag is used for line wrapping and typesetting of the paragraph. After the line break, the upper and lower lines The text distance is based on line-height.

[Recommended tutorial: "

html video tutorial"]

##

and

When the css style is not set for p, the effect of using one

paragraph tag is equivalent to using two
line break tags

      <p>标记的使用 
  清平调
云想衣裳花想容,

春风拂槛露华浓,

若非群玉山头见,

会向瑶台月下逢,

Copy after login

Rendering:

What is the difference between <p> and <br> in HTMLFor more programming-related knowledge, please visit:

Programming Learning

!!

The above is the detailed content of What is the difference between

and
in HTML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!