Knowledge summary of HTML paragraphs

php中世界最好的语言
Release: 2018-01-22 10:44:25
Original
1587 people have browsed it

This time I will bring you a summary of the knowledge of HTML paragraphs. What are the precautions when using HTML paragraphs? The following is a practical case, let’s take a look.

HTML Paragraph

Paragraphs are defined through the

tag.

Example

<p>This is a paragraph </p>
<p>This is another paragraph</p>
Copy after login


Tip: Forgetting to use the closing tag can produce unexpected results and errors.

The align attribute is deprecated in HTML4/5. Please use CSS instead. Paragraph supports event properties and global properties

Text alignment in paragraph

<!DOCTYPE html><html><head><style>h1 {text-align:center;}p.date {text-align:right;}p.main {text-align:justify;}</style></head>
<body>
<h1>CSS text-align 实例</h1><p class="date">2015 年 3 月 14 号</p><p class="main">“当我年轻的时候,我梦想改变这个世界;当我成熟以后,我发现我不能够改变这个世界,我将目光缩短了些,决定只改变我的国家;当我进入暮年以后,我发现我不能够改变我们的国家,我的最后愿望仅仅是改变一下我的家庭,但是,这也不可能。当我现在躺在床上,行将就木时,我突然意识到:如果一开始我仅仅去改变我自己,然后,我可能改变我的家庭;在家人的帮助和鼓励下,我可能为国家做一些事情;然后,谁知道呢?我甚至可能改变这个世界。”</p><p><b>注意:</b> 重置浏览器窗口大小查看 &quot;justify&quot; 是如何工作的。</p></body></html>
Copy after login

Syntax

<p align="left|right|center|justify">
Copy after login

Property value

HTML line breaks

If you want line breaks (new lines) without creating a new paragraph, use the
tag:

Example

<p>This is<br>a para<br>graph with line breaks</p>
<br /> 元素是一个空的 HTML 元素。由于关闭标签没有任何意义,因此它没有结束标签。
Copy after login

Tip: The
tag is very useful when writing address information or poetry. Note: Please use the
tag to enter blank lines instead of dividing paragraphs. Note: HTML Output - Usage Note We cannot determine the exact effect of the HTML being displayed. The size of the screen, as well as adjustments to the window, may lead to different results. With HTML, you cannot change the output by adding extra spaces or line breaks to the HTML code. When displaying the page, the browser removes extra spaces and blank lines from the source code. All consecutive spaces or empty lines are counted as one space. Note that all consecutive empty lines (newlines) in HTML code are also displayed as a single space.

<body>
<h1>春晓</h1>
<p>
春眠不觉晓,
  处处闻啼鸟。
    夜来风雨声,
      花落知多少。
</p>
<p>注意,浏览器忽略了源代码中的排版(省略了多余的空格和换行)。</p>
</body>
</html>
Copy after login

Output

春晓

I sleep in spring without realizing the dawn, and I can hear the singing of birds everywhere. The night comes wind and rain, Whispering Colour.

Note that the browser ignores formatting in the source code (excessive spaces and line breaks are omitted).

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

Detailed explanation of examples of HTML text formatting

Summary of frequently used tags in html

Special characters of html-css3 content: How to use "special symbols"

The above is the detailed content of Knowledge summary of HTML paragraphs. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!