Google Chrome, float, and media queries

故事扮演 提交于 2019-12-24 12:35:02

问题


I'm having a problem where Google Chrome sometimes incorrectly renders a floated element. More specifically, the markup looks like this:

<h1>
    Headline
    <small>Sub-heading</small>
</h1>

This is styled using this simple CSS:

h1 small {
    display: block;
}

@media (min-width: 750px) {
    h1 small {
        float: right;
    }
}

(here is a link to a jsfiddle.com which demonstrates the problem in action: http://jsfiddle.net/ys6L88r8/1/)

As you can see, the element is floated within a media query. When loading the page, if the browser window width exceeds the width specified in the media query, everything looks fine. However, if you resize the browser below this point and then back up again, the element incorrectly appears below the h1.

Is this a Google Chrome bug? I have verified that it works correctly in Firefox and Safari 8. I'm using Google Chrome 40.0.2214.91 (64-bit) for OS X.


回答1:


This behavior is a verified bug in Google Chrome: https://code.google.com/p/chromium/issues/detail?id=411256



来源:https://stackoverflow.com/questions/28174782/google-chrome-float-and-media-queries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!