XHTML验证失败,嵌套块元素。 [英] XHTML Validation fails with nested block elements.
问题描述
我的页面正常运行 - 但是当我来到
验证XHTML时,使用W3c的验证器失败了。基本上就像
一样,我可以看到它的问题是:
1:< div>
2:< ; a href =" somelink.htm">
3:< div>
4:< h2>标题< / h2>
5:一些文字
6:< / div>
7:< / a>
8:< / div>
在第3行,它失败了,因为它表示一个块级标记(我假设
< div>)在内联标记中被连接(我假设是< a>标签)。
在样式表中我将a标签设置为display:block;
所以我的问题是,如果< a>标签被CSS设置为''阻止'',这是技术上意味着XHTML是有效的,因为< a>标签是没有
在这种情况下内联更长?
I''ve got my page working just as I wanted it - but when I came to
validate the XHTML, using W3c''s validator it failed. Essentially as
far as I can see it the problem is this:
1: <div>
2: <a href="somelink.htm">
3: <div>
4: <h2>Title</h2>
5: Some text
6: </div>
7: </a>
8: </div>
At line 3, it fails because it says a block level tag (I assume the
<div>) is nexted in an inline tag (which I assume is the <a> tag).
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be ''block'' by the CSS, does
this technically mean that the XHTML is valid, as the <a> tag is no
longer inline in this context?
推荐答案
se*****@hotmail.com 写道:
se*****@hotmail.com wrote:
但是当我来验证XHTML,使用W3c的验证器失败了。
1:< div>
2:< a href =" somelink.htm">
3:< div>
4:< h2>标题< ; / h2>
5:一些文字
6:< / div>
7:< / a>
8:< / div>
<在第3行,它失败了,因为它表示块级标记(我假设
< div>)在内联标记中被连接(我假设它是< a>标记)。
是的,
在样式表中我将标签设置为display:block;
所以我的问题是,如果< a>标签被CSS设置为阻止,这在技术上意味着XHTML是有效的,因为< a>在这种情况下,标签是不是更长的内联?
but when I came to
validate the XHTML, using W3c''s validator it failed. 1: <div>
2: <a href="somelink.htm">
3: <div>
4: <h2>Title</h2>
5: Some text
6: </div>
7: </a>
8: </div>
At line 3, it fails because it says a block level tag (I assume the
<div>) is nexted in an inline tag (which I assume is the <a> tag).
Yes,.
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be ''block'' by the CSS, does
this technically mean that the XHTML is valid, as the <a> tag is no
longer inline in this context?
不,样式表没关系,DTD清楚地说明哪些元素是
< a>内允许
对于DTD而言,无论你使用什么样式表,XHTML都不是有效的。
-
Martin Honnen
http://JavaScript.FAQTs.com/
se*****@hotmail.com 写道:
se*****@hotmail.com wrote:
我的页面正常运行 - 但是当我来验证XHTML时,使用W3c的验证器失败了。基本上就像我能看到的那样问题是:
1:< div>
2:< a href =" somelink.htm">
3:< div>
4:< h2>标题< / h2>
5:有些文字
6:< / div>
7: < / a>
8:< / div>
在第3行,它失败了,因为它表示块级标记(我假设
< div>)在内联标签中(我假设是< a>标签)。我在样式表中将标签设置为display:block;
所以我的问题是,如果< a>标签被CSS设置为阻止,这在技术上意味着XHTML是有效的,因为< a>在这种情况下,标签是不是更长的内联?
I''ve got my page working just as I wanted it - but when I came to
validate the XHTML, using W3c''s validator it failed. Essentially as
far as I can see it the problem is this:
1: <div>
2: <a href="somelink.htm">
3: <div>
4: <h2>Title</h2>
5: Some text
6: </div>
7: </a>
8: </div>
At line 3, it fails because it says a block level tag (I assume the
<div>) is nexted in an inline tag (which I assume is the <a> tag).
In the stylesheet I have the a tag set as display:block;
So my question is, if the <a> tag is set to be ''block'' by the CSS, does
this technically mean that the XHTML is valid, as the <a> tag is no
longer inline in this context?
编号只有一种有效的风格。如果您需要有关如何更改的建议,请提供页面的网址。
-
Spartanicus >
se*****@hotmail.com 写道:
se*****@hotmail.com wrote:
我的页面正常运行 - 但是当我来验证XHTML时,使用W3c的验证器失败了。基本上就像我能看到的那样问题是:
1:< div>
2:< a href =" somelink.htm">
3:< div>
4:< h2>标题< / h2>
5:有些文字
6:< / div>
7: < / a>
8:< / div>
在第3行,它失败了,因为它表示块级标记(我假设
< div>)在内联标记中(我假设是< a>标记)。
是的。 (一旦我们更正了标签 - >元素)
在样式表中,我将a标签设置为display:block;
那又怎样?这就是< a>元素显示的不是它。
所以我的问题是,如果< a>标签被CSS设置为阻止,这在技术上意味着XHTML是有效的,因为< a>在这种情况下,标签是不是更长的内联?
I''ve got my page working just as I wanted it - but when I came to
validate the XHTML, using W3c''s validator it failed. Essentially as
far as I can see it the problem is this:
1: <div>
2: <a href="somelink.htm">
3: <div>
4: <h2>Title</h2>
5: Some text
6: </div>
7: </a>
8: </div>
At line 3, it fails because it says a block level tag (I assume the
<div>) is nexted in an inline tag (which I assume is the <a> tag).
Yes. (once we correct tag -> element)
In the stylesheet I have the a tag set as display:block;
So what? That''s just how the <a> element is displayed not what it is.
So my question is, if the <a> tag is set to be ''block'' by the CSS, does
this technically mean that the XHTML is valid, as the <a> tag is no
longer inline in this context?
No.< a>在(x)html中始终是一个内联元素,无论它是如何显示的。
Steve
No. <a> is always an inline element in (x)html regardless of how it is
displayed.
Steve
这篇关于XHTML验证失败,嵌套块元素。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!