css - Chrome / Edge don't resize container containing responsive images -


how make browser redraw / resize surrounding <div> scaled svgs other images?

if place image inside absolute positioned element, it's width or height adapt accordingly, this:

<div style="position: absolute; height: 40%; background: blue;">    <!-- square transparent gif -->    <img       style="height: 100%; width: auto; background: #0f0; opacity: 0.6"      src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7"    >  </div>

and works if use svg, –except– if resize browser in chrome/edge. works in firefox.

try resizing fullscreen demo in safari, chrome, firefox    <div style="position: absolute; height: 40%; background: blue;">    <!-- square transparent gif -->    <img       style="display: block; height: 100%; width: auto; background: #0f0; opacity: 0.6"      src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7"    >  </div>    <div style="position: absolute; height: 40%; top: 50%; background: blue;">    <!-- square transparent svg -->    <img       style="display: block; height: 100%; width: auto; background: #f00; opacity: 0.6"      src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'></svg>"    >  </div>

[edit1]: ok, on writing example code, no longer turned in safari, in chrome on both examples. problem same observed on more complex code in chrome though.

[edit2]: possibly no svg problem, appears on using raster images well

[edit3]: edge still having same problem, urg.

(transparent gif via smallest data uri image …)

ok, related chrome: svg container not rescaling responsively , (bad, bad!) fix seemingly force animation redraw this:

.redraw {    animation: redraw 1s infinite;  }         @keyframes redraw {    { min-width: 1px; }      { min-width: 2px; }  }
[fix:] try resizing fullscreen demo in safari, chrome, firefox    <div class="redraw" style="position: absolute; height: 40%; background: blue;">    <!-- square transparent gif -->    <img       style="display: block; height: 100%; width: auto; background: #0f0; opacity: 0.6"      src="data:image/gif;base64,r0lgodlhaqabaiaaaaaaap///yh5baeaaaaalaaaaaabaaeaaaibraa7"    >  </div>    <div class="redraw" style="position: absolute; height: 40%; top: 50%; background: blue;">    <!-- square transparent svg -->    <img       style="display: block; height: 100%; width: auto; background: #f00; opacity: 0.6"      src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='1' height='1'></svg>"    >  </div>


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -