HTML与BODY容器 [英] HTML vs BODY container

查看:93
本文介绍了HTML与BODY容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Richard Cornford写道:

Richard Cornford wrote:

html元素是(x)HTML文档中最外层的元素。
所有其他元素都是它的后代,其直接子元素是
头部和身体元素。
The html element is the outermost element in an (x)HTML document.
All other elements are its descendants, with its direct children being
the head and body elements.




至少对于Firefox来说并不完全正确(在Opera上完全不用测试
)。在Firefox中,HTML就像其他任何一个容器一样,你可以添加说图像和div'。试试

html {

宽度:100%;

身高:100%;

背景色:# DDD;

}

身体{

宽度:75%;

背景颜色:#FFF; < br $>
}


现在加上说< img src = ...>介于< / body>之间和< / html> ;.


IE在这种情况下进行自动树校正(因此< body>容器
仍然使用
)。我不知道它是否正确阅读规格

或渲染错误 - 但应该提及。



It is not exactly true at least for Firefox (keep missing to test in
full on Opera). In Firefox HTML is a container as any other where you
can add say images and div''s. Try
html {
width:100%;
height:100%;
background-color:#DDD;
}
body {
width:75%;
background-color:#FFF;
}

and now add say <img src=...> between </body> and </html>.

IE does automatical tree correction in such case (so <body> container
is still used instead). I don''t know if it''s a proper reading of specs
or a rendering bug - but should be mentioned.

推荐答案

VK写道:


(跟进设置)
VK wrote:

(Follow ups set)
Richard Cornford写道:
Richard Cornford wrote:
html元素是(x)HTML文档中最外层的元素。
所有其他元素都是它的后代,其直接子元素是头部和身体元素。
它不是至少对于Firefox来说是完全正确的(在Opera上完全不用测试)。在Firefox中,HTML是一个容器,就像你可以添加说图像和div'的任何其他容器一样。尝试
The html element is the outermost element in an (x)HTML document.
All other elements are its descendants, with its direct children being
the head and body elements.
It is not exactly true at least for Firefox (keep missing to test in
full on Opera). In Firefox HTML is a container as any other where you
can add say images and div''s. Try



....现在添加说< img src = ...>介于< / body>之间和< / html>。


.... and now add say <img src=...> between </body> and </html>.




因为(X)不允许HTML文档< img>元素作为子元素

< html>元素,这不是HTML文档。浏览器如何处理

作者的错误是无关紧要的。


-

David Dorward< http:// blog .dorward.me.uk /> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



Since (X)HTML documents are not allowed <img> elements as child elements of
the <html> element, that isn''t an HTML document. How browsers handle
author''s errors is irrelevent.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is




David Dorward写道:

David Dorward wrote:
由于(X)不允许HTML文档< img>元素作为< html>的子元素元素,这不是HTML文档。浏览器如何处理
作者的错误是无关紧要的。
Since (X)HTML documents are not allowed <img> elements as child elements of
the <html> element, that isn''t an HTML document. How browsers handle
author''s errors is irrelevent.




确认



ACK


VK写道:
VK wrote:
至少对于Firefox来说并不完全正确(在Opera上完全不用考试)。在Firefox中,HTML是一个容器,就像你可以添加说图像和div'的任何其他容器一样。
It is not exactly true at least for Firefox (keep missing to test in
full on Opera). In Firefox HTML is a container as any other where you
can add say images and div''s.




没有浏览器(我知道)没有无论如何这都是正确的。


例如


HTML {

背景:青色;

margin:2em;

padding:2em;

}


在CSS的正确渲染中,空白的2em由

填充创建的应该是青色的,但是由边距

创建的空白区域的2em不应该。


这个对于你发布的
组中的任何一个组来说,这不是一个合适的主题。交叉发布到ciwastylesheets,后续设置。


-

Toby A Inkster BSc(荣誉)ARCS

联系我〜 http://tobyinkster.co.uk/contact



No browser (that I know of) does this properly anyway.

e.g.

HTML {
background: cyan;
margin: 2em;
padding: 2em;
}

In a correct rendering of CSS, the 2em of blank space created by the
padding should be cyan, but the 2em of blank space created by the margin
should not.

This is not really an appropriate topic for either of the groups you
posted to though. Cross-posted to c.i.w.a.stylesheets, follow-ups set.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


这篇关于HTML与BODY容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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