Home  >  Article  >  Web Front-end  >  How to leave two spaces blank in a html5 paragraph

How to leave two spaces blank in a html5 paragraph

下次还敢
下次还敢Original
2024-04-21 12:03:171156browse

The method to implement two spaces before a paragraph in HTML is: use  entity, use text-indent style, use CSS tab attribute to directly insert tab characters

How to leave two spaces blank in a html5 paragraph

Two spaces before a paragraph

In HTML, you can use the following method to achieve two spaces before a paragraph:

Use&nbsp ; Entity

  The entity represents a non-space character, but the browser renders it as a space. To leave two spaces blank, you can use two consecutive   entities:

<code class="html"><p>  段落内容</p></code>

Use the text-indent style

text-indent The style attribute defines the indent of the first line of a paragraph. To leave two spaces blank, you can set text-indent to 2 em:

<code class="html"><p style="text-indent: 2em;">段落内容</p></code>

Use CSS tab attribute

tab The attribute defines the tab stop position between characters. To leave two spaces, you can set tab-size to 2 spaces:

<code class="css">p {
  tab-size: 2;
}</code>

Insert tab characters into HTML

tab characters can be inserted directly into the HTML source code:

<code class="html"><p>&#9;段落内容</p></code>

where represents a tab character.

When choosing a method, choose the most convenient and compatible method according to the specific situation.

The above is the detailed content of How to leave two spaces blank in a html5 paragraph. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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