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

Auto Save

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

              
                <svg
   xmlns="http://www.w3.org/2000/svg" 
   width="100"
   height="100"
   version="1.1">
  <script>
    const setTextPath = (event) => {
      const el = event.target;
      const elType = el.tagName;

      const multiarcNumber = Number(el.id.split('_')[1]);
      if (multiarcNumber > 0) {
      document
        .getElementById('multiarcText')
        .setAttribute('href',
          '#multiarc_' + (multiarcNumber - 1));
        el.remove();
      } else {
        console.log('this is the last path to set text on');
      }
      console.log(event.target.textContent);
    }
  </script>
    <path 
      id="multiarc_0"    onClick="setTextPath(event);"
      d="
        M 25, 50
        a 25,25 0 1,1 50,0
        a 25,25 0 1,1 -50,0
        " 
          fill="blue">
      <desc>path is M (CX - R), CY
        a R,R 0 1,0 (R * 2),0
        a R,R 0 1,0 -(R * 2),0</desc>
      </path>
  
    <path 
      id="multiarc_1" onClick="setTextPath(event);"
      d="
      M 50, 50
      m -25, 0
      a 25,25 0 1,0 50,0
      a 25,25 0 1,0 -50,0
    " 
    fill="purple"
          >
      <desc>path is M CX CY
      m -R, 0
      a R,R 0 1,0 (R * 2),0
      a R,R 0 1,0 -(R * 2),0</desc>
  </path>
  <path 
   id="multiarc_2"     onClick="setTextPath(event);"
     d="
        M 75, 50
        a 25,25 0 1,0 -50,0
        a 25,25 0 1,0 50,0
        " 
        fill="Red">
      <desc>path is  M (CX + R), CY
        a R,R 0 1,0 -(R * 2),0
        a R,R 0 1,0 (R * 2),0</desc>
      </path>
   <path fill="green" 
 id="multiarc_3"       onClick="setTextPath(event);"
      d="
        M 50, 50
        a 25,25 0 1,0 -50,0
        a 25,25 0 1,0 50,0
        "
        transform="translate(25)"  >
      <desc>path is 
      M CX, CY 
      a R, R 0 1,0 -(R * 2), 0 
      a R, R 0 1,0 R * 2, 0 and
     uses translate function to move +R on X axis.</desc>
      </path>
  <path id="multiarc_4" onClick="setTextPath(event);"
    d="
     M 50, 50
     v-25
     a25,25 0 0,0 -25,25
     a25,25 0 0,0 25,25
     a25,25 0 0,0 25,-25    
     a25,25 0 0,0 -50,0" 
        fill="orange"
        >
      <desc>This multi arc path will wrap differently between browser engines. 
    </desc>
  </path>
  <text dy="1" textLength="160">
    <textPath 
id="multiarcText" href="#multiarc_4" aria-label="Smashing">
        Smashing
    </textPath>
 </text>
  
</svg>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console