简体   繁体   English

IE7与IE8,Firefox,Chrome和Safari中的浮动DIV

[英]Floating DIVs in IE7 vs. IE8, Firefox, Chrome and Safari

I'm a bit stumped on this one. 我对此有些困惑。 I am referring to this page - http://savitarbernese.com/welcome.aspx . 我指的是此页面-http://savitarbernese.com/welcome.aspx At the moment it looks okay on IE7 but I can't seem to get it to work on other browsers. 目前在IE7上看起来还可以,但我似乎无法在其他浏览器上使用它。 As it stands now I had to wrap a couple of DIVs within tables to make the background extend behind the full content. 现在,我不得不在表中包装几个DIV,以使背景延伸到整个内容的后面。 I'm guessing this has something to do with the div overflow? 我猜这与div溢出有关吗? I'm not sure... 我不确定...

What's the best practice for cross-browser compatibility when using DIVs? 使用DIV时,跨浏览器兼容性的最佳实践是什么?

Cheers, D. 干杯D.

Add

overflow: hidden;

to #container and to #content in your css and presto! 在您的CSS和Presto中#容器和#内容!

This directive tells the browser to extend the height of the parent divs to the inside divs, even when they are floating. 该指令告诉浏览器将父div的高度扩展到内部div,即使它们是浮动的。

What's the best practice for cross-browser compatibility when using DIVs? 使用DIV时,跨浏览器兼容性的最佳实践是什么?

Allways code for firefox first, then for IE. 始终先为firefox编码,然后再为IE编码。

You are starting in the wrong end. 您的起点错误。 If you build it for IE7, it will rarely look the same in any other browser, and not in IE8 either. 如果您为IE7构建它,则在其他任何浏览器中它的外观都几乎不会相同,而在IE8中也是如此。

First make sure that it looks right in a standards compliant browser, for example Firefox, then it will almost always look the same in all other standard compliant browsers, which is just about everything except IE7 and earlier. 首先,确保它在符合标准的浏览器(例如Firefox)中看起来正确,然后在所有其他符合标准的浏览器中几乎始终保持相同外观,除了IE7和更早版本外,几乎所有其他浏览器都一样。 IE8 still has some rendering problems, but it's a lot closer to being compliant than IE7. IE8仍然存在一些渲染问题,但与IE7相比,它更接近于兼容。 You will have to make some tweaks to the page to make it look the same in IE7 also, but that is a lot less than trying to make it work the other way around. 您将不得不对该页面进行一些调整,以使其在IE7中也看起来相同,但这比尝试使其在其他方面起作用要少得多。

And first of all you should make sure that you have a proper doctype on your page so that it doesn't render in quirks mode. 首先,您应该确保页面上具有适当的doctype ,以使其不会以怪癖模式呈现。 That helps a lot when you want it to render the same across browsers. 当您希望它在浏览器之间呈现相同效果时,这很有帮助。

What's the best practice for cross-browser compatibility ...? 跨浏览器兼容性的最佳实践是什么?

Start by making sure your HTML validates. 首先确保您的HTML验证。

Thanks - that's a fair comment. 谢谢-这是一个公平的评论。 My dev machine is down and I only had access to IE7 at the time. 我的开发机关闭了,当时我只能访问IE7。 Normally I would definitely start off with Firefox 3.5 and go from there. 通常,我肯定会从Firefox 3.5开始并从那里开始。

That aside, it's a small problem that is hampering me at the moment. 除此之外,这是一个阻碍我的小问题。 In FF3.5, Safari, and IE8 the background of the content panel does not extend down the full height of the content like it does in IE7. 在FF3.5,Safari和IE8中,内容面板的背景不会像在IE7中那样向下扩展内容的整个高度。 I have changed the doctype to use XHTML 1.0 Strict 我已将文档类型更改为使用XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Is there something obvious I have missed here? 我在这里错过了明显的事情吗?

Thanks again. 再次感谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IE8,Chrome,Firefox和Safari之间的CSS兼容性 - CSS Compatibility between IE8, Chrome, Firefox and Safari 表格单元格的高度显示方式与IE8,IE7和Firefox不同 - Table cell heights display differently IE8 vs IE7 vs Firefox 在Gecko(Firefox)和Trident(IE)与Webkit(Chrome和Safari)中使用错误的颜色进行图像渲染 - Image-rendering madness with incorrect colors in Gecko (Firefox) and Trident (IE) vs. Webkit (Chrome and Safari) 尝试将三个div放在同一行上,一个放在另一个div上,以IE6,IE7,IE8和Firefox为中心 - Trying to put three divs on the same line, one against the other, centered, on IE6, IE7, IE8 and Firefox IE6 +中的Cookie,Safari与Opera,Firefox(JQuery) - Cookies in IE6+, Safari vs. Opera, Firefox (JQuery) URL编码IE8和Firefox / Chrome的UTF8字符 - URL encoding IE8 vs Firefox/Chrome for UTF8 characters Unicode特殊字符在Firefox和Chrome / IE中的显示方式有所不同 - Unicode special characters appear differently in Firefox vs. Chrome/IE Firefox与IE和Chrome的字体大小不同 - Different font size in Firefox vs. IE & Chrome IE和Firefox / Chrome / Safari中的表格行高度行为 - Table row height behavior in IE vs Firefox/Chrome/Safari Javascript 的 onclick 事件导致页面在 IE8 中重新加载,但在 Firefox、Safari、Chrome 和 Opera 中不重新加载? - Javascript's onclick event causes the page to reload in IE8, but not in Firefox, Safari,Chrome and Opera?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM