0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<p>As you<a>already know</a>, the browser ignores multiple spaces and line breaks in the HTML code. You can change this behavior using the <pre> tag.</p>
1
<p>As you<a>already know</a>, the browser ignores multiple spaces and line breaks in the HTML code. You can change this behavior using the <pre> tag.</p>
2
<p>However, CSS provides you with more flexible options for managing spaces and line breaks. The white-space property is responsible for doing this. It has the following values:</p>
2
<p>However, CSS provides you with more flexible options for managing spaces and line breaks. The white-space property is responsible for doing this. It has the following values:</p>
3
<ul><li>nowrap - It collapses extra spaces and displays all of the text in one line without any line breaks.</li>
3
<ul><li>nowrap - It collapses extra spaces and displays all of the text in one line without any line breaks.</li>
4
<li>pre - It preserves all spaces and line breaks that are included in the source code in a way that is similar to the <pre> tag.</li>
4
<li>pre - It preserves all spaces and line breaks that are included in the source code in a way that is similar to the <pre> tag.</li>
5
<li>pre-wrap - It functions similarly to the pre tag. However, it automatically adds line breaks if the text does not fit inside the container.</li>
5
<li>pre-wrap - It functions similarly to the pre tag. However, it automatically adds line breaks if the text does not fit inside the container.</li>
6
<li>normal - This is the default mode: extra spaces and line breaks are collapsed. The text is transferred while the spaces at the end of lines are removed.</li>
6
<li>normal - This is the default mode: extra spaces and line breaks are collapsed. The text is transferred while the spaces at the end of lines are removed.</li>
7
</ul><p>Actually,<a>white-space property</a>can take two more values:</p>
7
</ul><p>Actually,<a>white-space property</a>can take two more values:</p>
8
<ul><li>break-spaces - The behavior is identical to pre-wrap but when spaces are collapsed specially<i>marked</i>spaces are preserved, such as spaces at the end of a line.</li>
8
<ul><li>break-spaces - The behavior is identical to pre-wrap but when spaces are collapsed specially<i>marked</i>spaces are preserved, such as spaces at the end of a line.</li>
9
<li>pre-line - The behavior is the same as normal, but extra spaces are collapsed and lines are broken where the line break character and <br> tag are inserted as well as based on how long the line is.</li>
9
<li>pre-line - The behavior is the same as normal, but extra spaces are collapsed and lines are broken where the line break character and <br> tag are inserted as well as based on how long the line is.</li>
10
</ul>
10
</ul>