Pen Settings



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


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


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.


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.


                <circle-text r="3em" rotate="-90deg">
  CSS is super fun & cool & I like CSS!!!
<circle-text r="70">
  Our Tricks Are Treats Because CSS Is Sweet!
<circle-text style="color: hotPink; text-shadow: lightYellow 1px 1px 2px;">
  CSS in JS in CSS in JS in CSS in JS in CSS in JS in CSS in JS in CSS in JS

<script> // for the demo only
  window.addEventListener("load", testScriptedCreation);
  function testScriptedCreation() {    
    let ct = document.createElement("circle-text");
    ct.textContent = "123456789";
    window.setTimeout(()=>{ct.textContent="updated live from script"}, 1000);
    window.setTimeout(()=>{ct.setAttribute("r", "3em")}, 2000);
    window.setTimeout(()=>{ct.setAttribute("rotate", "0.5turn")}, 3000);


                /* to hide the content when custom elements aren't supported */
circle-text {
  display: none;
circle-text:defined {
  display: inline-block;

/* styles for this demo */
circle-text {
  /* customize the color and font as normal with CSS */
  color: skyBlue;
  text-transform: uppercase;
  font: large Tahoma, sans-serif;
  vertical-align: middle;
  /* position as you wish */

body {
  background: #222;



                if (window.customElements && document.body.attachShadow) { //mustard
class CircleText extends HTMLElement {
  static get observedAttributes() {
    return ['r', 'rotate'];
  static defaultRadius = 100;
  constructor() {
    let shadow = this.attachShadow({mode: 'open'});
    shadow.innerHTML = `
<svg id="s">
    svg { display: block; overflow: visible; padding: 1em; }
    textPath { fill: currentColor; }
  <defs><path id="p"/><circle id="r"/></defs>
  <text id="t"><textPath id="tp" xlink:href="#p"></textPath></text>
    // save links to the elements we'll need to modify
    this.svg = shadow.getElementById("s");
    this.path = shadow.getElementById("p");
    this.text = shadow.getElementById("t");
    this.textPath = shadow.getElementById("tp");
    // SVGLength object on a circle for unit conversion for path data
    // (since Safari and Firefox don't support text on a <circle> element)
    this.radius = shadow.getElementById("r").r.baseVal;
    // create a mutation observer for text content updates
    let watchText = new MutationObserver(this.updateText.bind(this));
    watchText.observe(this, {childList: true, characterData: true});
  connectedCallback() {
    // re-calculate dimensions, in case of font-relative units
  attributeChangedCallback(name, oldValue, newValue) {
    switch (name) {
      case "r":
        if (this.svg.isConnected) this.updateRadius(newValue);
      case "rotate":
  updateRadius(newValue) {
    var r;
    if (this.svg.isConnected) {
      //force an initial style calc to get em values
      let f = getComputedStyle(this.svg)["font-size"];
    try {
      this.radius.valueAsString = newValue;
      r = this.radius.value;
    } catch(e) {
      r = CircleText.defaultRadius;
    let d = 2*r;
    let offset = -1*r;
      {name: "height", value:d },
      {name: "width", value:d },
      {name: "viewBox", value: [offset, offset, d, d].join() }
      ({name, value})=>this.svg.setAttribute(name, value)
      `M${-r},0 A${r},${r},0 1 1 ${r},0 A${r},${r},0 1 1 ${-r},0Z`
  updateTransform(rotate) {
    if (rotate) {["transform"] = `rotate(${rotate})`;
    } else {["transform"] = "none";
  updateText() {
    this.textPath.textContent = this.textContent.trim();
}//end class
customElements.define("circle-text", CircleText, {});