取得< hr>用< p>换行 [英] Get <hr> in a new line with <p>

查看:39
本文介绍了取得< hr>用< p>换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是CSS的新手,我的问题是:我想在新行中添加一条水平线.

I am new to css and my question is this: I want a horizontal line in a new line.

所以我认为这是个好主意:

So I thought this would be a good idea:

<p><hr/></p>

但是它给出了:

<p></p>
<hr>
<p></p>

为什么?

谢谢您的回答.您说对了,这个问题很神秘.下次我将使用jsfiddle进行更具体的说明^^

推荐答案

HTML < p> 元素是一个块级元素,只能包含短语内容.即文本和标记文本包含.

The HTML <p> element is a block-level element that can only contain Phrasing Content; that is, text and the markup text contains.

< hr> 元素表示段落元素之间的主题中断,并且在一个段落内包含一个 是没有意义的.该标准规定,在< hr> 块级元素之前,将生成隐式的</p> ,以关闭任何打开的< p> 元素.

The <hr> element represents a thematic break between paragraph elements, and it makes no sense to have one inside a paragraph. The standard stipulates that before the <hr> block-level element, an implicit </p> is generated that closes any open <p> elements.

简而言之,您要执行的操作违反了段落和水平规则的语义.

In short, what you're trying to do violates the semantics of paragraphs and horizontal rules.

这篇关于取得&lt; hr&gt;用&lt; p&gt;换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆