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

              
                <div class="wrapper">
  <h1>SVG non scaling circle and rectangle</h1>
  <p>
    On the left are standard, scaling objects. 
    On the right are non-scaling ones, hacked using "vector-effect" and "stroke-linecap".
    Try resizing the window to see that elements on the right stay the same size.
  </p>
  <a href="https://muffinman.io/blog/svg-non-scaling-circles-and-rectangles/" target="_blank">Read the blog post</a>

  <div class="resize">
  <!-- filled circle -->
  <svg
    viewBox="0 0 200 100"
  >
    <circle
      cx="50"
      cy="50"
      r="50"
      fill="#2980b9"
    />
    <path
      stroke="#2980b9"
      d="M 150 50 l 0.0001 0"
      stroke-linecap="round"
      stroke-width="100"
      vector-effect="non-scaling-stroke"
    />
  </svg>
  </div>

  <div class="resize">
  <!-- filled rectangle -->
  <svg
    viewBox="0 0 200 100"
  >
    <rect
      x="10"
      y="0"
      width="100"
      height="100"
      fill="#16a085"
    />
    <path
      stroke="#16a085"
      d="M 150 50 l 0.0001 0"
      vector-effect="non-scaling-stroke"
      stroke-linecap="square"
      stroke-width="100"
    />
  </svg>
  </div>

  
  <div class="resize">
  <!-- outlined circle -->
  <svg
    viewBox="0 0 200 100"
  >
    <circle
      cx="50"
      cy="50"
      r="50"
      vector-effect="non-scaling-stroke"
      stroke="black"
      fill="none"
    />
    <path
      stroke="black"
      d="M 150 50 l 0.0001 0"
      vector-effect="non-scaling-stroke"
      stroke-linecap="round"
      stroke-width="100"
    />
    <path
      stroke="white"
      d="M 150 50 l 0.0001 0"
      vector-effect="non-scaling-stroke"
      stroke-linecap="round"
      stroke-width="98"
    />
  </svg>
  </div>

  <div class="resize">
  <!-- outlined rectangle -->
  <svg
    viewBox="0 0 200 100"
  >
    <rect
      x="10"
      y="0"
      width="100"
      height="100"
      vector-effect="non-scaling-stroke"
      stroke="black"
      fill="none"
    />
    <path
      stroke="black"
      d="M 150 50 l 0.0001 0"
      vector-effect="non-scaling-stroke"
      stroke-linecap="square"
      stroke-width="100"
    />
    <path
      stroke="white"
      d="M 150 50 l 0.0001 0"
      vector-effect="non-scaling-stroke"
      stroke-linecap="square"
      stroke-width="98"
    />
  </svg>
  </div>
</div>
              
            
!

CSS

              
                body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 18px;
  background: #ecf0f1;
  color: #323233;
  line-height: 1.3;
}

h1 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: bold;
}

p {
  margin: 20px 0;
  max-width: 400px;
  color: #525253;
}

a {
  color: #437ed4;
  text-decoration: none;
  border-bottom: 1px solid #ddd;
  transition: all 250ms;
  
  &:hover {
    border-bottom-color: #437ed4;
  }
}

.wrapper {
  position: relative;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

svg {
  display: block;
  overflow: visible;
}

.resize {
  background: white;
  overflow: auto;
  resize: both;
  padding: 30px;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
  margin: 20px 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console