开发者

Max-height scales image perfectly in FF, but Chrome has scrollbars

开发者 https://www.devze.com 2023-01-16 23:53 出处:网络
So I want a page that\'s nothing but a square image which scales up to the height of the window. Fine, great, I do:

So I want a page that's nothing but a square image which scales up to the height of the window. Fine, great, I do:

img
{
   max-height:100%;
   height:100%;
   width:auto;   
}

and stick an in a center-aligned div. Firefox loves it, but insists on the height:100%. Chrome doesn't need that, but adds a little开发者_JS百科 bit of height to the page and so a scrollbar pops up. The whole page itself is still rendering identically down to the last pixel, but Chrome seems to think its window is a little heightier than it actually is. What's going on?


Check the margin and padding on the html and body elements -- often a hidden source of pain!

Yes, I know this was in my comment, but this way the question looks answered :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消