css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <h1>Test Scaling Of SVG Images In Fluid Layouts</h1>

<p><em>Resize your browser so that the images scale down.</em></p>

<p>Browsers IE9+ (desktop & mobile) do not respect ratios of SVG images inside <code>img</code> tags in fluid layouts. All other browsers scale SVG images as expected with the default output of an Illustrator file. This is a series of tests of SVG images using different attributes on the SVG tag.  If you want a long-form explaination, it is best to visit <a href=http://triangle717.wordpress.com/2014/06/07/ie-inkscape-svg/>Triangle717's "Internet Explorer and Inkscape SVGs"</a>.</p>

<p>One of the resolutions is to force IE to expand <code>img</code> tags containing SVG images to the desired exact (max-)width.  This is not always desired, but does at least get IE to behave itself with ratio'd scaling.  Using `max-width: 100%;` percentages do <b>not</b> work in IE when browser is not resized (normal size); the image will fill the entire contraining box (600px in this case).</p>

<p><strong>Comment or edit the media query</strong> in the CSS to view the issue in IE.</p>

<p>Other solutions are available in <a href="https://gist.github.com/larrybotha/7881691">this gist</a>.</p>

<p><small>All SVG images are 500px x 500px and constrained by the width of their containing divs for a fluid experience.</small></p>

<h2 id=preserveaspectratio>Viewbox, width, height, preserveAspectRatio</h2>
<p><code>&lt;svg ... viewBox="0 0 500 500" width="500px" height="500px" preserveAspectRatio="xMinYMin meet"&gt;</code></p>
<p>A solution proposed <a href="http://soqr.fr/testsvg/svg-inside-img.php">here</a></p>
<div class="constrain">
  <img src="https://fixate.github.io/svg-placeholders/img/fixate-inverse-with-viewbox-width-height.svg">


<h2 id=viewbox-width-height>Viewbox, width, height - default Illustrator output</h2>
<p><code>&lt;svg ... viewBox="0 0 500 500" width="500px" height="500px"&gt;</code></p>
<p>The default output of Illustrator. This is desired, and is what scales as expected on all non-IE browsers.</p>
<div class="constrain">
  <img src="https://fixate.github.io/svg-placeholders/img/fixate-inverse-with-viewbox-width-height.svg">


<h2 id=width-height>Width & height only - default Inkscape output</h2>
<p><code>&lt;svg ... width="500px" height="500px"&gt;</code></p>
<p>To help with a <a href="https://github.com/twitter/twemoji/issues/27">bug report</a></p>
<div class="constrain">
  <img src="https://tombyrer.github.io/svg-placeholders/fixate-inverse-with-width-height.svg">


<h2 id=viewbox>Viewbox Only</h2>
<p><code>&lt;svg ... viewBox="0 0 500 500"&gt;</code></p>
<p>Removing width and height attributes - solution proposed on <a href="http://stackoverflow.com/questions/9777143/svg-in-img-element-proportions-not-respected-in-ie9/9792254#9792254">Stack Overflow</a></p>
<div class="constrain">
  <img src="https://fixate.github.io/svg-placeholders/img/fixate-inverse-with-viewbox.svg">


<h2 id=none>None of the above attributes</h2>
<p><code>&lt;svg ... &gt;</code></p>
<p>Test how browsers behave when none of the attributes used above are applied.</p>
<div class="constrain">
  <img src="https://fixate.github.io/svg-placeholders/img/fixate-inverse.svg">
              .constrain {
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid #f2f2f2;
/* Ensure an image never exceeds the width of its container */
img {
  max-width: 100%;
  height: auto;

 * Let's target IE to respect aspect ratios and sizes for img tags containing SVG files
 * [1] IE9
 * [2] IE10+
// 1
img[src*=".svg"] {
  width: 500px\9; 
// 2
@media screen and (min-width:0\0) {
  img[src*=".svg"] {
    width: 500px; 

body {
  font-family: Arial;
  color: #666;
  max-width: 600px;
  margin:0 auto;
  padding: 0 2em;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................