Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

              
                <table>
  <tbody>
    <tr>
      <th scope="col">&nbsp;&nbsp;&nbsp;URLencode&nbsp;🡆<br>charset&nbsp;🡇</th>
      <th scope="col">all<br>&nbsp;"<i>%3Csvg%20xmlns</i>&nbsp;"&nbsp;</th>
      <th scope="col">none<br>&nbsp;"<i>&#x3C;svg xmlns</i>&nbsp;"&nbsp;</th>
      <th scope="col">all but spaces<br>&nbsp;"<i>%3Csvg&nbsp;xmlns</i>&nbsp;"&nbsp;</th>
    </tr>
    <tr>
      <th scope="row">full<br />&nbsp;"<i>charset=utf-8,</i>&nbsp;"&nbsp;</th>
      <td class="charset-full_encode-all">&nbsp;</td>
      <td class="charset-full_encode-none">&nbsp;</td>
      <td class="charset-full_encode-nospaces">&nbsp;</td>
    </tr>
    <tr>
      <th scope="row">none</th>
      <td class="charset-none_encode-all">&nbsp;</td>
      <td class="charset-none_encode-none">&nbsp;</td>
      <td class="charset-none_encode-nospaces">&nbsp;</td>
    </tr>
    <tr>
      <th scope="row">shorthand<br />&nbsp;"<i>utf-8,</i>&nbsp;"&nbsp;</th>
      <td class="charset-shorthand_encode-all">&nbsp;</td>
      <td class="charset-shorthand_encode-none">&nbsp;</td>
      <td class="charset-shorthand_encode-nospaces">&nbsp;</td>
    </tr>
  </tbody>
</table>

<div>
<h1>Compatibility issues of SVG in CSS data URIs</h1><p> The table above contains nice cells with</p><ul><li><b>a blue background</b> (<i>background-color:#555599;</i>&nbsp;)</li><li><b>SVG background image of moon</b> (<i>background-image:url('data:image/svg+xml;...</i>&nbsp;)</li></ul><p>Even though the CSS is <a target="_blank" href="https://jigsaw.w3.org/css-validator/validator"> officially valid</a>, depending on your current browser, the SVG background may not render in some cells, depending on the contents and format of the CSS background-image URI.</p><p>Each of the blue cells contains a unique combination of</p><ul><li>definition of encoding (rows)</li><li>encoding of the SVG itself (columns)</li></ul><p>More on this is contained in the following post about <a target="_blank" href="https://sparkx.online/svg-css-backgrounds/">SVG in CSS backgrounds</a> post, inlcluding info on <a target="_blank" href="https://sparkx.online/svg-css-backgrounds/#optimizing-svg">SVG optimization</a> for smaller file sizes, <a target="_blank" href="https://sparkx.online/svg-css-backgrounds/#converting-to-svg">Converting to SVG from other formats</a>, etc.</p></div>


              
            
!

CSS

              
                .charset-full_encode-all{
background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221%22%20viewBox%3D%220%200%20225%20225%22%3E%3Cpath%20d%3D%22M0%200zm118%2011c3%200%207-1%209%202%202%202%201%205-1%206a92%2092%200%200%200-3%20116c16%2023%2044%2037%2072%2037%202%200%205%200%206%202%202%202%200%205-1%207-16%2017-38%2029-61%2032A101%20101%200%200%201%2051%2043c17-19%2042-30%2067-32M43%2069a92%2092%200%200%200%2021%20114%2092%2092%200%200%200%20115%205l8-8a101%20101%200%200%201-90-83c-5-23%200-48%2012-68l4-8c-29%203-56%2022-70%2048z%22%2F%3E%3Cpath%20fill%3D%22%23ebebeb%22%20d%3D%22M43%2069c14-26%2041-45%2070-48l-4%208a101%20101%200%200%200%2078%20151l-8%208a92%2092%200%200%201-115-5A92%2092%200%200%201%2043%2069z%22%2F%3E%3C%2Fsvg%3E')}

.charset-full_encode-none{
background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 225 225"><path d="M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z"/><path fill="#ebebeb" d="M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z"/></svg>')}

.charset-full_encode-nospaces{
background-image:url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 version%3D%221%22 viewBox%3D%220 0 225 225%22%3E%3Cpath d%3D%22M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z%22%2F%3E%3Cpath fill%3D%22%23ebebeb%22 d%3D%22M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z%22%2F%3E%3C%2Fsvg%3E')}

.charset-none_encode-all{
background-image:url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221%22%20viewBox%3D%220%200%20225%20225%22%3E%3Cpath%20d%3D%22M0%200zm118%2011c3%200%207-1%209%202%202%202%201%205-1%206a92%2092%200%200%200-3%20116c16%2023%2044%2037%2072%2037%202%200%205%200%206%202%202%202%200%205-1%207-16%2017-38%2029-61%2032A101%20101%200%200%201%2051%2043c17-19%2042-30%2067-32M43%2069a92%2092%200%200%200%2021%20114%2092%2092%200%200%200%20115%205l8-8a101%20101%200%200%201-90-83c-5-23%200-48%2012-68l4-8c-29%203-56%2022-70%2048z%22%2F%3E%3Cpath%20fill%3D%22%23ebebeb%22%20d%3D%22M43%2069c14-26%2041-45%2070-48l-4%208a101%20101%200%200%200%2078%20151l-8%208a92%2092%200%200%201-115-5A92%2092%200%200%201%2043%2069z%22%2F%3E%3C%2Fsvg%3E')}
.charset-none_encode-none{
background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 225 225"><path d="M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z"/><path fill="#ebebeb" d="M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z"/></svg>')}

.charset-none_encode-nospaces{
background-image:url('data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 version%3D%221%22 viewBox%3D%220 0 225 225%22%3E%3Cpath d%3D%22M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z%22%2F%3E%3Cpath fill%3D%22%23ebebeb%22 d%3D%22M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z%22%2F%3E%3C%2Fsvg%3E')}

.charset-shorthand_encode-all{
background-image:url('data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221%22%20viewBox%3D%220%200%20225%20225%22%3E%3Cpath%20d%3D%22M0%200zm118%2011c3%200%207-1%209%202%202%202%201%205-1%206a92%2092%200%200%200-3%20116c16%2023%2044%2037%2072%2037%202%200%205%200%206%202%202%202%200%205-1%207-16%2017-38%2029-61%2032A101%20101%200%200%201%2051%2043c17-19%2042-30%2067-32M43%2069a92%2092%200%200%200%2021%20114%2092%2092%200%200%200%20115%205l8-8a101%20101%200%200%201-90-83c-5-23%200-48%2012-68l4-8c-29%203-56%2022-70%2048z%22%2F%3E%3Cpath%20fill%3D%22%23ebebeb%22%20d%3D%22M43%2069c14-26%2041-45%2070-48l-4%208a101%20101%200%200%200%2078%20151l-8%208a92%2092%200%200%201-115-5A92%2092%200%200%201%2043%2069z%22%2F%3E%3C%2Fsvg%3E')}

.charset-shorthand_encode-none{
background-image:url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 225 225"><path d="M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z"/><path fill="#ebebeb" d="M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z"/></svg>')}

.charset-shorthand_encode-nospaces{
background-image:url('data:image/svg+xml;utf-8,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 version%3D%221%22 viewBox%3D%220 0 225 225%22%3E%3Cpath d%3D%22M0 0zm118 11c3 0 7-1 9 2 2 2 1 5-1 6a92 92 0 0 0-3 116c16 23 44 37 72 37 2 0 5 0 6 2 2 2 0 5-1 7-16 17-38 29-61 32A101 101 0 0 1 51 43c17-19 42-30 67-32M43 69a92 92 0 0 0 21 114 92 92 0 0 0 115 5l8-8a101 101 0 0 1-90-83c-5-23 0-48 12-68l4-8c-29 3-56 22-70 48z%22%2F%3E%3Cpath fill%3D%22%23ebebeb%22 d%3D%22M43 69c14-26 41-45 70-48l-4 8a101 101 0 0 0 78 151l-8 8a92 92 0 0 1-115-5A92 92 0 0 1 43 69z%22%2F%3E%3C%2Fsvg%3E')}

table{
  background:#aaa;
  font-family:sans-serif
}
th,td{
  width:7rem;
  height:7rem;
}
td{
  /*background:#559 none no-repeat 0 2rem/5rem;*/
  background-color:#555599;
  background-position:0 2rem;
  background-size:5rem;
  background-repeat:no-repeat;
  text-align:left;
  vertical-align:top;
}
th{
  background-color:#ccc;
}
              
            
!

JS

              
                
              
            
!
999px

Console