除了 <br /> 之外,html 中是否还有另一种换行方式?
Is there another way of breaking lines in html apart from <br />?
我正在构建一个 asp.net 应用程序,并且在我的一个 ListItem
中使用了一个 <br />
元素。不推荐这样做,但它仍然有效。
还有其他方法可以在 HTML
中换行吗? (不是 CSS
!)
我经常使用
和 &close;
等其他字符。使用 &<code>
是否有一些等效的断线?
段落可以被 <p>
个标签包围。
<p>This is my first paragraph.</p>
<!-- a line break will be rendered here -->
<p>This is my second paragraph.</p>
如果您的内容是一个列表,您可以用 <li>
标签标记每个列表项,并用 <ul>
或 <ol>
标签包围整个列表,以表示无序列表或有序列表,分别。后者在左边有数字而不是项目符号。
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
</ul>
对于非语义块,您可以将内容包围在 <div>
个标签中。
我不确定 html 中新行的短代码,但 html 中有块元素。
块元素在下一行之后占据容器和元素的整个宽度。
例如
<p></p> or <div></div>
您也可以使用
,现在 editor/code 中的每一行都会反映在浏览器中,无需任何特殊代码或元素。
默认不忽略白色space的HTML标签是<pre>
:
The HTML <pre>
element (or HTML Preformatted Text) represents
preformatted text. Text within this element is typically displayed in
a non-proportional ("monospace") font exactly as it is laid out in the
file. Whitespace inside this element is displayed as typed.
所有其他人都需要 CSS 这样做。
您可以使用 "pre" 标签发送已损坏的文本。示例:
<pre>
LINE 1
LINE 2
LINE 3
</pre>
另一种选择是使用段落:
<p> Line 1 </p>
<p> Line 2 </p>
我正在构建一个 asp.net 应用程序,并且在我的一个 ListItem
中使用了一个 <br />
元素。不推荐这样做,但它仍然有效。
还有其他方法可以在 HTML
中换行吗? (不是 CSS
!)
我经常使用
和 &close;
等其他字符。使用 &<code>
是否有一些等效的断线?
段落可以被 <p>
个标签包围。
<p>This is my first paragraph.</p>
<!-- a line break will be rendered here -->
<p>This is my second paragraph.</p>
如果您的内容是一个列表,您可以用 <li>
标签标记每个列表项,并用 <ul>
或 <ol>
标签包围整个列表,以表示无序列表或有序列表,分别。后者在左边有数字而不是项目符号。
<ul>
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
</ul>
对于非语义块,您可以将内容包围在 <div>
个标签中。
我不确定 html 中新行的短代码,但 html 中有块元素。 块元素在下一行之后占据容器和元素的整个宽度。 例如
<p></p> or <div></div>
您也可以使用
,现在 editor/code 中的每一行都会反映在浏览器中,无需任何特殊代码或元素。
默认不忽略白色space的HTML标签是<pre>
:
The HTML
<pre>
element (or HTML Preformatted Text) represents preformatted text. Text within this element is typically displayed in a non-proportional ("monospace") font exactly as it is laid out in the file. Whitespace inside this element is displayed as typed.
所有其他人都需要 CSS 这样做。
您可以使用 "pre" 标签发送已损坏的文本。示例:
<pre>
LINE 1
LINE 2
LINE 3
</pre>
另一种选择是使用段落:
<p> Line 1 </p>
<p> Line 2 </p>