一个有效的 HTML 文档需要 html、head、title 和 body 标签,并且您需要一个 doctype 标记可防止浏览器以怪异模式呈现页面。因此,以标准兼容模式呈现的最小 HTML 文档如下所示:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
That's because you don't have an HTML document. You just have some HTML tags that you are throwing at the browser, and the browser tries its best to use it, and does that surprisingly well.
As you don't have a doctype tag, IE renders the page in quirks mode, which basically means that it tries to emulate the oldest possible way of doing everything. As position:fixed is a recent addition, it's not supported in this mode.
A valid HTML document needs the html, head, title and body tags, and you need a doctype tag to keep the browser from rendering the page in quirks mode. So, the minimal HTML document that renders in standard compliant mode looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
Your style tag goes inside the head tag, and the content goes inside the body tag.
If you can't merge your background image, then you need to use z-index. Give #grid a lower z-index than #wrap and you'll be sorted (as long as both elements are positioned, which they are at the minute).
发布评论
评论(3)
那是因为您没有 HTML 文档。您只需将一些 HTML 标签扔给浏览器,浏览器就会尽力使用它,并且做得非常好。
由于您没有
doctype
标记,IE 会以怪异模式呈现页面,这基本上意味着它会尝试模拟最古老的可能方式来完成所有操作。由于position:fixed
是最近添加的,因此此模式不支持它。一个有效的 HTML 文档需要
html
、head
、title
和body
标签,并且您需要一个doctype
标记可防止浏览器以怪异模式呈现页面。因此,以标准兼容模式呈现的最小 HTML 文档如下所示:您的
style
标记位于head
标记内,内容位于body< /代码> 标签。
您可以使用不同的
doctype
标记,具体取决于您要使用的 HTML 版本,请参阅 W3C 推荐的 Doctype 声明列表。That's because you don't have an HTML document. You just have some HTML tags that you are throwing at the browser, and the browser tries its best to use it, and does that surprisingly well.
As you don't have a
doctype
tag, IE renders the page in quirks mode, which basically means that it tries to emulate the oldest possible way of doing everything. Asposition:fixed
is a recent addition, it's not supported in this mode.A valid HTML document needs the
html
,head
,title
andbody
tags, and you need adoctype
tag to keep the browser from rendering the page in quirks mode. So, the minimal HTML document that renders in standard compliant mode looks like this:Your
style
tag goes inside thehead
tag, and the content goes inside thebody
tag.There are different
doctype
tags that you can use, depending on which version of HTML you want to use, see W3C's Recommended list of Doctype declarations.如果您无法合并背景图像,那么您需要使用 z-index。给 #grid 一个比 #wrap 更低的 z-index ,你就会被排序(只要两个元素都被定位,它们当时的位置)。
If you can't merge your background image, then you need to use z-index. Give #grid a lower z-index than #wrap and you'll be sorted (as long as both elements are positioned, which they are at the minute).
将缩略图合并为一个 png/jpg 文件怎么样?然后你就可以:
不再需要摆弄 z-index 了。
How about merging the thumbnails as one png/jpg file? Then you can:
Don't need to fiddle with z-index no more.