< p为H.标记是XHTML中的块级元素? [英] <p> tag is a block-level element in XHTML?

查看:135
本文介绍了< p为H.标记是XHTML中的块级元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在HTML4.0中

 < p> 

标记不是块级元素。
在XHTML 1.0中怎么样?



谢谢

这是HTML4.0
http://www.w3.org/TR/html401/ struct / text.html


P元素代表一个段落。它不能包含块级元素(包括P本身)。

是我的误解吗?

解决方案

据我所知, p 是块级元素,至少返回到HTML 3.2。
$ b


可以出现在
文档主体中的大多数元素都属于两个
组中的一个:块级元素
会导致段落中断,文本级别
元素不会。公共块
级元素包括H1到H6
(标题),P(段落)LI(列表
项)和HR(水平规则)。
通用文本级元素包括EM,
I,B和FONT(字符强调),A
(超文本链接),IMG和APPLET
(嵌入对象)和BR(行
休息)。请注意,块元素
通常充当文本
级别和其他块级元素
(不包括标题和地址
元素)的容器,而文本级元素
只能用作包含其他文本级
元素。确切的模型取决于
元素。


http://www.w3.org/TR/REC-html32

和XHTML 1.0除了不太宽松外,其实和HTML 4.01一样。这意味着这些元素具有相同的目的,是相同的级别(block,inline,table),只是这些规则适用:


  • 全部元素和属性名称必须以小写字母显示

  • 必须引用所有属性值

  • 非空元素需要结束标记
  • $在严格的XHTML中,b $ b
  • 空元素被终止使用空格和尾部斜线

  • 不允许属性最小化

  • ,所有内联元素必须包含在一个块元素中


编辑:


P元素表示一个段落。
它不能包含块级元素
(包括P本身)。

这只是表示 p 不能拥有其他块级别的元素,这意味着它是块级别的,它不能包含它自己。

I know that in HTML4.0

<p>

tag is not a block-level element. What about in XHTML 1.0?

Thank you

This is the reference for HTML4.0 http://www.w3.org/TR/html401/struct/text.html

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

Was that my misinterpretation?

解决方案

As far as I know, p is a block-level element going back to at least HTML 3.2.

Most elements that can appear in the document body fall into one of two groups: block level elements which cause paragraph breaks, and text level elements which don't. Common block level elements include H1 to H6 (headers), P (paragraphs) LI (list items), and HR (horizontal rules). Common text level elements include EM, I, B and FONT (character emphasis), A (hypertext links), IMG and APPLET (embedded objects) and BR (line breaks). Note that block elements generally act as containers for text level and other block level elements (excluding headings and address elements), while text level elements can only contain other text level elements. The exact model depends on the element.

http://www.w3.org/TR/REC-html32

And XHTML 1.0 is really the same exact thing as HTML 4.01 except less lenient. Meaning the elements serve the same purpose, are the same "level" ( block, inline, table ), just these rules apply:

  • all elements and attribute names must appear in lower case
  • all attribute values must be quoted
  • non-Empty Elements require a closing tag
  • empty elements are terminated using a space and a trailing slash
  • no attribute minimization is allowed
  • in strict XHTML, all inline elements must be contained in a block element

EDIT:

The P element represents a paragraph. It cannot contain block-level elements (including P itself).

This just means that the p cannot own other block level elements inside, meaning because it is block-level it cannot contain itself.

这篇关于&LT; p为H.标记是XHTML中的块级元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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