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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -