What is the difference between br, p and DIV in html?

php中世界最好的语言
Release: 2017-11-23 17:32:04
Original
4206 people have browsed it

Many people don't understand. br, p and DIV are all tags. What's the difference between them? Can I use it however I want? This is not the case. Today I will tell you in detail what are the differences between the three tags br, p, and DIV

div and p are paired combination closing tags;


is a single closing tag.

Start with

, end with
;

Start with

, end with

Small example:

<div>内容一</div> 
<div>内容二</div> 
<p>第一段</p> 
<p>第二段</p>
Copy after login

Different effects

div tags and p tags are used for web page layout.

div is a common layout tag, which layouts content like a span tag. Setting the CSS style of DIV can achieve the content layout effect.

p tag is a paragraph tag, usually used for article segmentation. The

br tag is used for content line breaks. For example, the function of text wrapping and typesetting.

br can be placed in div and p, and div can also be placed in p, and p can also be placed in div.

Small example:

<div style="color:red">我在div标签内,字体颜色为红色</div> 
<p>我是第一段文章内容</p> 
<p>我是第二段文章内容</p> 
<p>我是第三段文章内容<br />我被换行<br/>我也被br换行</p>
Copy after login

The above is the difference between the three tags br, p, and DIV. For more exciting information, please pay attention to php中文网Others related articles!

Related reading:

How to display circular images in css3

##How to make the web page black and white

How to use bordercolor in CSS

The above is the detailed content of What is the difference between br, p and DIV 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template