需要关闭段落标签吗? [英] Closing paragraph tag required?
问题描述
以下html是否有效?
< p>< hr width =" 50%">< / p>
>
或者以下内容会更技术上正确?
< p>
< hr width =" 50% >
我是否需要结束< / p>标签?
Is the following html valid?
<p><hr width="50%"></p>
Or would the following be more "technically correct"?
<p>
<hr width="50%">
Do I require the closing </p> tag?
推荐答案
AndyZa写道:
AndyZa wrote:
以下html是否有效?
< p>< hr width =" 50%">< / p>
No.
或者以下内容会更技术上正确?
< p>
< hr width =" 50%">
是。
我是否需要结束< / p>标签?
Is the following html valid?
<p><hr width="50%"></p>
No.
Or would the following be more "technically correct"?
<p>
<hr width="50%">
Yes.
Do I require the closing </p> tag?
编号第一个例子相当于
< p>< / p>< hr width =" 50%">< / p>
这显然是无效的,第二个相当于
< p>
< / p>< hr width =" 50%">
这是有效的。
P的结束标记是可选的。 HR是一个块级元素,作为P的孩子不允许
但是解析器不会抱怨这个,因为
< / p>是可选的,P元素是隐式关闭的。
-
Benjamin Niemann
电子邮件:pink at odahoda dot de
WWW: http://pink.odahoda.de/
在我们的上一集中,
< 11 ******************* **@g10g2000cwb.googlegroups。 com>,
comp.infosystems上可爱而有才华的AndyZa
广播。 www.authoring.html:
In our last episode,
<11*********************@g10g2000cwb.googlegroups. com>,
the lovely and talented AndyZa
broadcast on comp.infosystems.www.authoring.html:
以下html是否有效?
< p>< hr width =" 50%">< / p>
No. P不能包含HR。当HR遇到
时,P元素会关闭。
或者以下内容会更技术上正确?
< p>
< hr width =" 50%">
否.P。P中没有任何内容表示这是一个段落,不要制作一些
空格。
我是否需要结束< / p> tag?
Is the following html valid? <p><hr width="50%"></p>
No. P cannot contain HR. The P element is closed when the HR is
encountered.
Or would the following be more "technically correct"? <p>
<hr width="50%">
No. There is nothing in P. P means "this is a paragraph," not "make some
space."
Do I require the closing </p> tag?
在HTML 4x中,P的结束标记是可选的。你的问题是你显然还没有理解HTML是什么。如果你有一个
段落,请用P标记。你似乎认为P意味着:
在这里跳过一行,它没有。如果我误解了您的
意图,请说明当您尝试将HR放入P时,您尝试使用的是什么类型的文档结构
.
-
Lars Eighner us****@larseighner.com http://www.larseighner.com/
这将是最好的可能的世界,
如果没有宗教信仰。 - John Adams
In HTML 4x, the closing tag for P is optional. Your problem is that you
appearently have not understood what HTML is all about. If you have a
paragraph, mark it up with P. You seem to think P means something like:
"skip a line here," which it doesn''t. If I have misunderstood your
intentions, please explain what sort document structure you are trying to
represent when you attempt to put HR in P.
--
Lars Eighner us****@larseighner.com http://www.larseighner.com/
This would be the best of all possible worlds,
if there were no religions in it. -- John Adams
>如果你有一个段落,用P标记它。你似乎认为P意味着:
> If you have a paragraph, mark it up with P. You seem to think P means something like:
在这里跳过一行,它没有。
"skip a line here," which it doesn''t.
你很有见!我修改了我邪恶的方式......
You''re spot on! I''ve amended my wicked ways...
这篇关于需要关闭段落标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!