Home Web Front-end HTML Tutorial Can html p tag contain a tag? Description of the role of html p tag

Can html p tag contain a tag? Description of the role of html p tag

Aug 29, 2018 pm 01:38 PM
html p

This article mainly introduces the function of the HTML p tag. The

tag can contain the explanation of the tag. It also mainly explains the function of the HTML p tag. Now Let's take a look at this article

First of all, let's talk about whether the a tag can be included in the p tag?

Let’s first look at the

tag, which is a block-level element. It occupies an exclusive line and its width automatically fills the width of its parent element.

The tag is an inline element. It will not occupy a single line. Adjacent inline elements will be arranged in the same line. The line will not be broken until it cannot fit in one line. Its width changes with the content of the element.

Block-level elements can contain inline elements. , so the tag can be included in the

tag.

Here is an example where the

tag contains the tag:

<!doctype html>
<html>
 <head>
 <meta charset="UTF-8">
 <title>我是网页标题(我是PHP中文网)</title>
 </head>
 <body >
 <p>这里是PHP中文网<a href="http://www.php.cn">点击这里进入</a>这也是PHP中文网,点击中间的字</p>
 </body>
</html>
Copy after login

Here is the effect and the picture:

Can html p tag contain a tag? Description of the role of html p tag

The picture above is the picture that comes out of the code. The purple underlined one is the a tag of the hyperlink.

Now let’s talk about the role of the HTML p tag:

First of all, the

tag defines the paragraph.

The p element will automatically create some white space before and after it. The browser adds these spaces automatically, or you can specify them in your stylesheet.

Page tag usage:

You can specify paragraphs only within a block, or you can combine paragraphs with other paragraphs, lists, forms, and predefined formats used together with the text. In general, this means that paragraphs can appear anywhere there is appropriate text flow, such as in the body of the document, within list elements, etc.

From a technical point of view, paragraphs cannot appear in headers, anchors, or other places that strictly require content to be text only. In fact, most browsers ignore this restriction and format paragraphs as part of the content of the containing element.

In general, the

tag defines segments. There can be many paragraphs within a

tag.

There are also examples. This is an article I found on the Internet. I displayed it in sections:

<!doctype html>
<html>
 <head>
 <meta charset="UTF-8">
 <title>我是网页标题(我是PHP中文网)</title>
 </head>
 <body >
 <p>这里是PHP中文网<a href="http://www.php.cn">点击这里进入</a>这也是PHP中文网,点击中间的字</p>
<p>推进“一带一路”建设的5年,是成果丰硕的5年。习近平总书记指出,5年来的“一带一路”建设,推动我国形成陆海内外联动、东西双向互济的开放新格局。</p>
<p>黑龙江黑河边境经济合作区管委会主任 王海东:习近平总书记提出“政治互信、经济互融、人文互通”,本着这个原则,黑河利用独特的区域优势,从过去的一个边境走向了“一带一路”的前沿。</p>
<p>从落地生根到持久发展,习总书记在讲话中要求各地区加强与国家战略对接,这为各地更好对接“一带一路”建设指明了方向。</p>
</body>
</html>
Copy after login

You can see the effect:

Can html p tag contain a tag? Description of the role of html p tag You see, this is the role of the paragraph

tag, the content inside is the content of a paragraph.

Okay, the above is the entire content of our article. If you have any questions, you can ask below

[Editor’s recommendation]

How to add html The text in the pre tag is wrapped? Usage examples of html pre tag

What does the HTML ul tag mean? Detailed explanation of the role of HTML ul tag

The above is the detailed content of Can html p tag contain a tag? Description of the role of html p tag. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles