Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>SVG background image test</title>
</head>
<body>
  <table>
    <caption>No width or height in SVG</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svghaswidth">
    <caption>Width and height set in SVG</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svghasonlywidth">
    <caption>Only width set in SVG</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svghasonlyheight">
    <caption>Only height set in SVG</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svgminminmeet">
    <caption>SVG has preserveAspectRatio = xMinYMin meet</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svgmidmidmeet">
    <caption>SVG has preserveAspectRatio = xMidYMid meet</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svmaxmaxmeet">
    <caption>SVG has preserveAspectRatio = xMaxYMax meet</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  
  <table class="svmaxmaxmeet">
    <caption>SVG has viewBox numbers equal to desired background size</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
      <td><div class="square onedim">.onedim.square</div></td>
      <td><div class="square nodim">.nodim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
      <td><div class="rect onedim">.onedim.rect</div></td>
      <td><div class="rect nodim">.nodim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
      <td><div class="otherrect onedim">.nodim.otherrect</div></td>
      <td><div class="otherrect nodim">.nodim.otherrect</div></td>
    </tr>
  </table>
  <table class="uneven">
    <caption>Uneven background-size</caption>
    <tr>
      <td><div class="square fixdim">.fixdim.square</div></td>
    </tr>
    <tr>
      <td><div class="rect fixdim">.fixdim.rect</div></td>
    </tr>
    <tr>
      <td><div class="otherrect fixdim">.fixdim.otherrect</div></td>
    </tr>
  </table>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
thatemilpro
0viewers