SVG resize

by tmtron

HTML

<div id="container">
 <!--
 
 preserveAspectRatio="xMinYMin meet"
  preserveAspectRatio="none"
 -->

  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
  width="100%" height="100%">
    <image class="backgroundImg"  preserveAspectRatio="none" width="100%" height="100%"
 xlink:href="http://placehold.it/1920x1080">
    </image>
    <g class="hover_group" opacity="0.2">
      <a xlink:href="http://www.wooh.be/shop/mobilier/wooh-original-office-home/giroflex-353.html">
        <text x="652" y="706.9" font-size="20">First zone</text>
        <rect x="572" y="324.1" opacity="0.5" fill="red" width="264.6" height="387.8"></rect>
      </a>
    </g>
    <rect x="20%" y="40%"  fill="green" width="10%" height="20%" style="z-index: -1"></rect>
    <text x="0" y="60%" class="text" textLength="30%">TextDescr</text>
  </svg>
</div>

CSS

.hover_group:hover {
  opacity: 1;
  z-index: -1;
}

.backgroundImg {
  width: 100%;
  height: 100%;
}

.text {
  font: italic 32px serif;
  fill: blue;
}

#container {
  overflow: hidden;
  resize: both;
  position: relative;
  width: 500px;
  height: 200px;
  border: 2px solid;
}

#container svg {
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}