Home >Web Front-end >HTML Tutorial >How to write two empty spaces in html
There are two ways to create two-space code in HTML: 1. Use character entities; 2. Use CSS to set element spacing. The choice depends on fixed spacing requirements and CSS style impact requirements.
Two methods to create empty two-space code in HTML
In HTML, you can use the following two methods Method to create empty two-space code:
1. Use character entity
The character entity represents a non-newline whitespace character and can create a space. To create two spaces, just use two character entities:
<code class="html"> </code>
2. Using CSS
CSS can be used to set the spacing between elements. To create two spaces, you can use the following CSS rule:
<code class="css">element { padding-left: 2em; }</code>
In this example, element is the element to be padded, and the padding-left property specifies the distance from the left side of the element to its content. 2em represents two em units, em is the size unit relative to the current font.
Usage method
Both methods can be used to create two-space code. Which method you choose depends on your specific needs and preferences.
The above is the detailed content of How to write two empty spaces in html. For more information, please follow other related articles on the PHP Chinese website!