html - Resize div to fit content (image) after resizing content -
this seems tricky 1 :).
here fiddle http://jsfiddle.net/xhrklwwl/2/ , there description pseudo-code (accurate code in fiddle):
<div id="gridsettings" style="height:100%"> <div id="gridsmaller" style="height:100%"> <img id="gridsmallerimg" style="height:200%"/> </div> </div>
i trying make responsive square icons based on height , css only.
theory following:
i have square icon image (200x400px - 2 in 1 hover purposes). image inputed html <img>
(not css background property). <img>
has it's wrapper div
, <img>
se height:200%. expecting img
scale can see top 50% , width of div
determined width of img
, same visible height (50% of total height) -> since image 200x400px... there go... square :).
practice:
it works until resize window. height of icon-wrapping div
10% of window height, if resize window, div
height goes well, , img
inside. div's
width stays same before resizing , icons clipped :(. if change css prop (via ff dom inspector, hover event...), div
updates correct width.
does have idea, causing it?
thank very :)
ps: no need send me js solution. if neccessary can write own.
Comments
Post a Comment