欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

html段落_HTML段落

程序员文章站 2022-06-08 10:20:12
...

html段落

The HTML paragraph is given by the <p> element, that represents a paragraph. A paragraph generally is represented on the webpage as a block of text separated that has first-line indentation and spacing between the lines. In HTML, the paragraph could be a structural group having some relatable content, and the content could be an image or other fields.

HTML段落<p>元素给出,该元素表示一个段落。 段落通常在网页上表示为一个文本块,该文本块具有第一行缩进和行之间的间距。 在HTML中,该段落可以是具有一些相关内容的结构组,并且该内容可以是图像或其他字段。

A paragraph is a block-level element in HTML. It has a starting as well as an ending tag. The content of the paragraph is present between these two tags.

段落是HTML中的块级元素。 它具有开始标签和结束标签。 段落的内容位于这两个标签之间。

For example, a simple paragraph in HTML is given as follows:

例如, HTML中的一个简单段落如下:

    <p>this is paragraph.</p>

By default, the line break is available with the <p> tag. The text of the paragraph goes within the same line if the break element is not present.

默认情况下,换行符可通过<p>标签使用 。 如果不存在break元素,则段落的文本将位于同一行中。

For example, A paragraph without the BREAK element. It would give output as:

例如,没有BREAK元素的段落。 它将输出为:

    <p>here is a text with no breaking in the line</p>

The output would be as:

输出为:

here is a text with no breaking in the line

For example A paragraph with a BREAK element. It would give output as:

例如,带有BREAK元素的段落 。 它将输出为:

    <p> here is a text <br> with break <br> in the line <br> 
    as the BREAK element is present </p>

The output would be as:

输出为:

here is a text 
with no breaking
in the line
as the BREAK element is present

The paragraph element also has a margin for the text in the paragraph; this margin is present by default. The next line is given as soon as the paragraph ends.

段落元素段落中也有一个空白。 默认情况下存在此边距。 该段结束后立即给出下一行。

The paragraph ends could be ended automatically as soon as another <p> tag is encountered.

遇到另一个<p>标记时, 段落结尾可以自动结束。

Example:

例:

    <p> this is the first paragraph
    <p> this is the second paragraph

The output would be as:

输出为:

this is the first paragraph
this is the second paragraph

<p>标签的一些属性 (Some attributes of <p> tag)

align attribute: This specifies the alignment of the paragraph. The values of the align attribute are LEFT, RIGHT and CENTER. But this attribute has a limitation, that is not supported with the HTML5 version.

align属性 :这指定段落的对齐方式。 align属性的值为LEFT,RIGHT和CENTER。 但是此属性有一个限制,HTML5版本不支持该限制。

style attribute: The style attribute is used for providing the styling in line with the element. But it also could be given in the style element or by some external CSS file.

style属性 :style属性用于提供与元素一致的样式。 但是它也可以在style元素中或通过一些外部CSS文件给出。

Example with attributes:

具有属性的示例:

<p style =" display: block;  margin-top: 1em;  margin-bottom: 1em;  margin-left: 0; margin-right: 0;">
	Text here...
</p>

or

要么

<style> p {
    display: block;
    margin-top: 1em;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
}
</style>

The <p> tag supports the other global attributes in HTML.

<p>标记支持HTML中的其他全局属性。

翻译自: https://www.includehelp.com/html/html-paragraph.aspx

html段落

上一篇: 012-html 折行

下一篇: HTML 段落