html - chrome layout only correct after window resize -
i'm having strange issue chrome initial rendering of page incorrect, done forces redraw (eg. resizing window) layout rendered correctly. maximizing seems cause problems.
initial (bad) layout: redrawn (good) layout
html, body { margin: 0; padding: 0; } .photo-frame { display: inline-block; padding: 1.75%; background-color: #111; box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 1); } .photo-matte { display: inline-block; padding: 5% 6%; background-color: #fff; box-shadow: inset 2px 2px 12px 3px rgba(0, 0, 0, 0.6), inset 0px 0px 1px 1px rgba(0, 0, 0, 1); } .photo-inset { display: inline-block; border: solid 5px #000; border-top-color: rgba(170, 170, 170, 1.0); border-right-color: rgba(216, 216, 216, 1.0); border-bottom-color: rgba(240, 240, 240, 1.0); border-left-color: rgba(204, 204, 204, 1.0); } img { height: 70vh; display: block; }
<html> <body> <div class="photo-frame"> <div class="photo-matte"> <div class="photo-inset"> <img src="http://jlee.me/glow_cube.jpg" /> </div> </div> </div> </body> </html>
update: after more tinkering, seems fail when css height specified.
i think it's weird bug of chrome. can offer use vh
instead of %
in padding property. hope it'll give similar result.
also removed ".photo-inset" block , set borders directly image.
html, body { margin: 0; padding: 0; } .photo-frame { display: inline-block; border: 5vh solid #000; background-color: #111; box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 1); } .photo-matte { display: block; padding: 5vh 6vh; background-color: #fff; box-shadow: inset 2px 2px 12px 3px rgba(0, 0, 0, 0.6), inset 0px 0px 1px 1px rgba(0, 0, 0, 1); } img { height: 70vh; display: block; border: solid 5px #000; border-top-color: rgba(170, 170, 170, 1.0); border-right-color: rgba(216, 216, 216, 1.0); border-bottom-color: rgba(240, 240, 240, 1.0); border-left-color: rgba(204, 204, 204, 1.0); }
<html> <body> <div class="photo-frame"> <div class="photo-matte"> <img src="http://jlee.me/glow_cube.jpg" /> </div> </div> </body> </html>
Comments
Post a Comment