Pen Settings

HTML

CSS

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

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="background-image" class="experiment"></div>

<div class="experiment"><img src="http://denilson.sa.nom.br/aboutme.svg#twitter"></div>

<svg id="svg-use" class="experiment" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 64 64">
  <use xlink:href="http://denilson.sa.nom.br/aboutme.svg#twitter" width="64" height="64" />
</svg>

<article>
  <p>I'm trying to refer to a <code>&lt;symbol&gt;</code> defined inside an external <code>.svg</code> file. They both should show the twitter icon.</p>
  <p>The first square uses CSS <code>background-image: url(http://example.com/example.svg#example);</code>. Instead of showing just the Twitter icon, it shows the whole SVG image (Chrome 35 and Firefox 29).</p>
  <p>The second square uses <code>&lt;img&gt;</code> tag to point to the the symbol inside the SVG. It does not work.</p>
  <p>The third square uses an SVG <code>&lt;use&gt;</code> element. It fails because browsers block this cross-domain request. However, it works correctly in Chrome 35 and Firefox 29 if both files are on the same domain.</p>
  <p>See also: <a href="https://css-tricks.com/svg-sprites-use-better-icon-fonts/">Icon System with SVG Sprites</a></p>
  <p><strong>UPDATE!</strong> See <a href="http://www.broken-links.com/2012/08/14/better-svg-sprites-with-fragment-identifiers/">Better SVG Sprites With Fragment Identifiers</a></p>
</article>
              
            
!

CSS

              
                .experiment {
  display: inline-block;
  width: 64px;
  height: 64px;
  background-color: #FFC;
  border: 1px solid black;
}
#background-image {
  background-image: url(http://denilson.sa.nom.br/aboutme.svg#twitter);
}
              
            
!

JS

              
                
              
            
!
999px

Console