å?ˆè§?CSS BUG,昨天赶工写完一个页é?¢ï¼Œä¸“题页é?¢ï¼Œå?ˆéœ€è¦?é‡?用,没花太多时间处ç?†ç»†èŠ‚ä¸Šçš„ä¸œè¥¿ï¼Œå› ä¸ºå¤§éƒ¨åˆ†æ¨¡å?—都å?¯ä»¥ç›´æŽ¥æ›¿æ?¢ï¼›ä»Šå¤©æ—©ä¸Šå?Œäº‹å’Œæˆ‘说:“Safari 下é?¢èƒŒæ™¯æ˜¯ä¸?是有1pxå??移?â€?,å?¬å®Œè§‰å¾—挺奇怪,一般ä¸?应该å˜åœ¨è¿™æ ·çš„问题的,然å?Žä¸€çœ‹å°±æœ‰äº†è¿™ç¯‡æ–‡ç«
首先é‡?现BUG(æ¤Demoä»…CSS3支æŒ?,Chrome/Safari最佳):
<div class="t_shell">
<div class="t_wrap">
<div class="t_panel">
<div class="t_inner" title=".t_inner"></div>
</div>
</div>
</div>
.t_wrap{ background:#eee; margin:0 auto; width:401px;}
.t_panel{ background:-webkit-linear-gradient(top, #299a0b 0%,#299a0b 100%) no-repeat; background-position:50% 20px; padding:140px 0 0 0; height:140px;}
.t_inner{ background:-webkit-linear-gradient(top, #cf0404 43%,#ff3019 100%); margin:0 auto; height:120px; width:200px;}
点击“.t_wrap width +3pxâ€?æŒ‰é’®å¢žåŠ (div.t_wrap)宽度时候,能够很明显的看到绿色å?—(div.t_panel)有1pxå·¦å?³çš„æ?¥å›žæ‘†åŠ¨ã€‚
出现以上BUGçš„åŽŸå› ï¼Œå›½å¤–â€œACKOâ€?ç»™å‡ºçš„åŽŸå› å¦‚ä¸‹ï¼š
The width of the viewport
The odd/even size of the box/element
Background image is bigger/smaller than the viewport
Background image is padded evenly/unevenly around the box (1px difference). (*)
(*) Note that there is a choice whether to pad more on the left or on the right. I chose the left. This means that the last 4 rows of test cases are inherently ambiguous: a browser that misaligns all of these in the same fashion is in fact being consistent, just in the opposite direction.
原文地�:
解决方案:
在我测试过程ä¸ï¼Œå?‘现基本上å?ªè¦?上é?¢ç»™å‡ºåŽŸå› å‰?é?¢ä¸¤æ?¡ä¸?出现,å?³ï¼šå®½åº¦ä¸?è·Ÿéš?视图å?˜åŒ–,容器的宽度适ä¸ä¸ºå?¶æ•°æˆ–者奇数;就å?¯ä»¥æœ‰æ•ˆé?¿å…?
å?¦å¤–,在查找资料的过程ä¸ï¼Œå?‘现å?¦å¤–一个解决方案,ä¸?è¿‡æˆ‘æ ¹æ?®æˆ‘测试的好åƒ?ä¸?是很给力,当视图宽度å?˜åŒ–时,ä¾?然能é‡?现:
@media screen and (-webkit-min-device-pixel-ratio:0){
.t_panel{ background-position:50.001% 20px;}
}
原文地�:
上一篇:JPG�进 & PNG/PNG24 交错测试
下一篇:7行崩掉(Crash)Chrome
共0评论