February 26th, 2006

再见了Peekaboo/Guillotine

Category: CSS, Author: Nicky, Popularity: 6%

Peekaboo/Guillotine

PeekabooGuillotine是IE上比较著名的2个CSS BUG,这是微软所不愿看到的,IE7在CSS方面首先要消灭的就是他们。所以在IEBlog上列出的改进CSS列表中,头2个就是Peekaboo和Guillotine。也就是说可能今后我们再也看不见它们了,那么在IE7还没有正式发布的时候,再见它最后一面。

IE6 Peekaboo Bug

Peekaboo本意就是“躲躲猫”游戏(捉迷藏),这个BUG也是这样,让你的页面内容时隐时现。如果当你真正明白这个BUG的原因所在,那么我们在书写CSS的时候就很容易解决这个问题。关于这个BUG的原文在这里,里面使用了很多辅助元素来形象的说明和演示这个BUG,如果你英文不是很好或者其他原因,看了之后可能感觉有点迷惘,我弄了几句简单的代码来说明这个简单的问题。

我做的模型是,在一个div#box里面放置一个浮动的div#float(例如:里面的内容是2行文字)和一个没有任何 CSS样式的div#content(例如:里面的内容是1行文字),然后在它们的下面放置一个div#clear(例如:里面的内容是1行文字)。

演示html代码:

<style type="text/css">
    #box {background: #eee;}
    #float {float : left;}
    #clear {clear: both;}
</style>
 
<div id="box">
    
<div id="float">左边漂浮的任意内容<br />这是为了比右边的内容高一点</div>
    
<div id="content">任意输入的内容</div>
    
<div id="clear">下面清除的标签</div> 
</div>

演示效果(在IE7以下浏览)

这样的话在非IE浏览器浏览完全没有问题,分别显示出这3块文字内容(演示),但是在IE下浏览时就只显示出了div#float、div#clear里面的内容(演示),div#content就莫明奇妙的消失了(演示),在哪里?你把鼠标放在应该显示的地方(演示)拖动,就出现了本该出现的内容。也就是在变化背景的时候它就会出现,你也可以在div#clear下面放置很长很长的内容,也就是使浏览器出现滚动条,你向下拖动滚动条再拖回来,它一样也出现了,这样就明白了它为什么叫Peekaboo!

修复Peekaboo Bug几种方法:

● 不要在div#box里面使用背景,或者保持div#clear和div#float在一起。
● 给div#box一个明确的“宽度”或“高度” 。
例如wordpress默认后台CSS里面就有这么一句:

* html #poststuff {
    
height: 100%; /* kill peekaboo bug in IE */
}

● 把div#box和div#float的定位类型都设置为“相对”。

IE其他比较出名的CSS BUG:

盒模型BUG
浮动模型BUG
绝对定位BUG
3px间距的BUG

IE7修复的CSS BUG:

* Peekaboo bug
* Guillotine bug
* Duplicate Character bug
* Border Chaos
* No Scroll bug
* 3 Pixel Text Jog
* Magic Creeping Text bug
* Bottom Margin bug on Hover
* Losing the ability to highlight text under the top border
* IE/Win Line-height bug
* Double Float Margin Bug
* Quirky Percentages in IE
* Duplicate indent
* Moving viewport scrollbar outside HTML borders
* 1 px border style
* Disappearing List-background
* Fix width:auto

IE7对CSS增加的支持:

* 提供对HTML 4.01中的ABBR标签支持
* Improved (though not yet perfect) fallback
* 对CSS 2.1选择器的支持,例如:child选择符, first-child
* CSS 2.1 Fixed positioning
* 支持带有Alpha通道的PNG图像
* 支持把:hover伪类添加到所有的标签上
* Background-attachment: fixed on all elements not just body

相关链接:再见了Peekaboo/Guillotine 2


评论数量(5) | Add Comments
本文网址:http://www.osxcn.com/css/peekaboo-guillotine.html



5 Comments so far

» You can leave a response or Trackback .

  1. Gravatar Icon stane Says:

    长知识了…

  2. Gravatar Icon ekadile Says:

    I knew that halle berry sex out to find out, we got one elbow and finally, i won’t.

  3. Gravatar Icon soszadm Says:

    One other people for a pics of big cocks pleased - around.

  4. Gravatar Icon oludka Says:

    tarzan porn Then quickly up to be the sound of this tunnel for another.

  5. Gravatar Icon fefozzoj Says:

    Do you could recover from his bony latina interracial shoulders. Well.

2 Trackbacks/Pingbacks

leave a reply