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="content-container">
  <header>
    <h1>Markup Is Functional, Not Visual</h1>
    <h2>Progress Bars</h2>
  </header>
  <main>
    <p>A wonderful thing about design is its ability to transform rudimentary tasks and elements into appealing and adaptive design languages. However, the way something looks is not always indicative to how it works.</p>
    <p>Some native elements, like <code class="inline">progress</code>, have limited styling capabilities and may require the use of non-standard markup. In these cases when markup is visual, markup must also communicate as clearly as its design.</p>

    <section class="content-section">
      <h3>Without perceivable markup</h3>
      <div class="grid">
        <div class="progress-container">
          <div class="progress-bar" style="--current-progress: 25"></div>
          <span>25%</span>
        </div>

        <div class="progress-container">
          <div class="progress--circle progress--25">
            <div class="progress__number">25%</div>
          </div>
        </div>
      </div>
    </section>

    <section class="content-section">
      <h3>With perceivable markup</h3>
      <div class="grid">
        <div class="progress-container">
          <div class="progress-bar" style="--current-progress: 75" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75" role="progressbar" title="Next level"></div>
          <span aria-hidden="true">75%</span>
        </div>

        <div class="progress-container">
          <div class="progress--circle progress--75" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75" role="progressbar" title="Next level">
            <div aria-hidden="true" class="progress__number">75%</div>
          </div>
        </div>
      </div>
    </section>

    <section class="content-section">
      <h3>With functional markup</h3>
      <div class="grid">
        <div class="progress-container">
          <progress max="100" value="50" aria-label="Next level">50%</progress>
        </div>
      </div>
    </section>

  </main>
  <footer>
    <p>Keys To An Accessibility Mindset</p>
    <a href="https://twitter.com/DanielYuschick" aria-label="@Daniel Yuschick on Twitter">@DanielYuschick</a>
  </footer>
</div>
              
            
!

CSS

              
                .progress-container {
  text-align: center;
  font-weight: 600;
}

.progress-bar {
  block-size: 24px;
  background-color: var(--color-aux-200);
  border-radius: var(--space-base-1x);
  overflow: hidden;
  position: relative;

  &::after {
    content: " ";
    block-size: 100%;
    inline-size: calc(var(--current-progress) * 1%);
    background-color: var(--color-core-primary);
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
  }
}

progress {
  inline-size: 100%;
}

/* Start Radial Progress From: https://codepen.io/keithpickering/pen/JjowRo */
$spacing: 1rem;
$themeColor: var(--color-core-primary);
$backColor: var(--color-aux-200);

.progress--circle {
  position: relative;
  display: inline-block;
  margin: $spacing;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: $backColor;

  &:before {
    content: "";
    position: absolute;
    top: 12.5px;
    left: 12.5px;
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background-color: var(--color-aux-950);
  }
  &:after {
    content: "";
    display: inline-block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: $themeColor;
  }
}

.progress__number {
  position: absolute;
  top: 50%;
  width: 100%;
  line-height: 1;
  text-align: center;
  color: var(--color-aux-100);
  transform: translateY(-50%);
}

/**
* $step is set to 5 by default, meaning you can only use percentage classes in increments of five (e.g. 25, 30, 45, 50, and so on). This helps to reduce the size of the final CSS file. If you need a number that doesn't end in 0 or 5, you can change the text percentage while rounding the class up/down to the nearest 5.
*/
$step: 5;
$loops: round(100 / $step);
$increment: 360 / $loops;
$half: round($loops / 2);
@for $i from 0 through $loops {
  .progress--bar.progress--#{$i * $step}:after {
    width: $i * $step * 1%;
  }
  .progress--circle.progress--#{$i * $step}:after {
    @if $i < $half {
      $nextDeg: 90deg + ($increment * $i);
      background-image: linear-gradient(
          90deg,
          $backColor 50%,
          transparent 50%,
          transparent
        ),
        linear-gradient($nextDeg, $themeColor 50%, $backColor 50%, $backColor);
    } @else {
      $nextDeg: -90deg + ($increment * ($i - $half));
      background-image: linear-gradient(
          $nextDeg,
          $themeColor 50%,
          transparent 50%,
          transparent
        ),
        linear-gradient(270deg, $themeColor 50%, $backColor 50%, $backColor);
    }
  }
}
/* End Radial Progress From: https://codepen.io/keithpickering/pen/JjowRo */

.grid {
  display: grid;
  gap: var(--space-base-4x);
  inline-size: 100%;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
/**********
*** SETUP
**********/
/***** Properties *****/
:root {
  --color-aux-50: rgb(10, 10, 11);
  --color-aux-100: rgb(29, 29, 32);
  --color-aux-200: rgb(48, 48, 54);
  --color-aux-300: rgb(77, 77, 86);
  --color-aux-400: rgb(96, 96, 108);
  --color-aux-500: rgb(115, 115, 130);
  --color-aux-600: rgb(147, 147, 159);
  --color-aux-700: rgb(169, 169, 178);
  --color-aux-800: rgb(190, 190, 197);
  --color-aux-900: rgb(223, 223, 226);
  --color-aux-950: rgb(242, 239, 233);

  --color-core-primary: #bc3908;
  --color-core-secondary: #f6aa1c;
  --color-core-tertiary: #621708;

  --font-family-body: "Inter", sans-serif;
  --font-family-heading: "Sofia Sans", sans-serif;

  --space-base: 4px;
  --space-base-half: calc(var(--space-base) / 2);
  --space-base-1x: var(--space-base);
  --space-base-2x: calc(var(--space-base) * 2);
  --space-base-3x: calc(var(--space-base) * 3);
  --space-base-4x: calc(var(--space-base) * 4);
  --space-base-6x: calc(var(--space-base) * 6);
  --space-base-8x: calc(var(--space-base) * 8);
  --space-base-12x: calc(var(--space-base) * 12);
  --space-base-16x: calc(var(--space-base) * 16);
  --space-base-24x: calc(var(--space-base) * 24);
}

/***** Landmarks *****/
body {
  /* background by SVGBackgrounds.com */
  background-color: var(--color-aux-950);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3Crect fill='none' stroke-width='1' id='a' x='-400' y='-300' width='800' height='600'/%3E%3C/defs%3E%3Cg style='transform-origin:center'%3E%3Cg transform='rotate(64.8 0 0)' style='transform-origin:center'%3E%3Cg transform='rotate(-155.2 0 0)' style='transform-origin:center'%3E%3Cg transform='translate(1000 750)'%3E%3Cuse stroke='%23F2F4F3' href='%23a' transform='rotate(9.7 0 0) scale(2.097)'/%3E%3Cuse stroke='%23f2eae5' href='%23a' transform='rotate(19.4 0 0) scale(2.194)'/%3E%3Cuse stroke='%23f1e0d7' href='%23a' transform='rotate(29.1 0 0) scale(2.291)'/%3E%3Cuse stroke='%23f1d7c9' href='%23a' transform='rotate(38.8 0 0) scale(2.388)'/%3E%3Cuse stroke='%23f1cdbc' href='%23a' transform='rotate(48.5 0 0) scale(2.485)'/%3E%3Cuse stroke='%23f1c3ae' href='%23a' transform='rotate(58.2 0 0) scale(2.582)'/%3E%3Cuse stroke='%23f0b9a0' href='%23a' transform='rotate(67.9 0 0) scale(2.679)'/%3E%3Cuse stroke='%23f0af92' href='%23a' transform='rotate(77.6 0 0) scale(2.776)'/%3E%3Cuse stroke='%23f0a684' href='%23a' transform='rotate(87.3 0 0) scale(2.873)'/%3E%3Cuse stroke='%23f09c76' href='%23a' transform='rotate(97 0 0) scale(2.97)'/%3E%3Cuse stroke='%23ef9268' href='%23a' transform='rotate(106.7 0 0) scale(3.067)'/%3E%3Cuse stroke='%23ef885a' href='%23a' transform='rotate(116.4 0 0) scale(3.164)'/%3E%3Cuse stroke='%23ef7e4d' href='%23a' transform='rotate(126.1 0 0) scale(3.261)'/%3E%3Cuse stroke='%23ef753f' href='%23a' transform='rotate(135.8 0 0) scale(3.358)'/%3E%3Cuse stroke='%23ee6b31' href='%23a' transform='rotate(145.5 0 0) scale(3.455)'/%3E%3Cuse stroke='%23EE6123' href='%23a' transform='rotate(155.2 0 0) scale(3.552)'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: cover;
  background-position: center center;
  display: grid;
  align-content: center;
}

footer {
  --padding-offset: var(--space-base-4x);

  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  border-block-start: 1px solid #000;
  padding-block: var(--padding-offset);
  margin-block-start: var(--padding-offset);
}

/***** Textual *****/
a,
a:visited,
a:active,
a:link {
  color: var(--color-aux-50);

  &:not([aria-current="page"], .active):hover {
    background: var(--color-aux-800);
  }
}

span,
p {
  font-family: var(--font-family-body);
}

p + p {
  margin-block-start: 1rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-heading);
}

code {
  background: var(--color-aux-100);
  color: var(--color-aux-950);
  display: block;
  padding: 0.25rem 0.5rem;

  &.inline {
    display: inline-block;
  }
}

/***** Other *****/
.content-container {
  inline-size: 75%;
  margin-inline: auto;
}

/**********
*** RESET
**********/
* {
  margin: 0;
  padding: 0;
}

*,
::before,
::after {
  box-sizing: border-box;
}

*:where(:not(fieldset, progress, meter)) {
  background-origin: border-box;
  background-repeat: no-repeat;
  border-style: solid;
  border-width: 0;
}

html {
  -webkit-text-size-adjust: none;
  block-size: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

body {
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-block-size: 100%;
  text-rendering: optimizeSpeed;
}

:where(img, svg, video, canvas, audio, iframe, embed, object) {
  display: block;
}
:where(img, svg, video) {
  block-size: auto;
  max-inline-size: 100%;
}

:where(svg) {
  fill: currentColor;
  stroke: none;
}

:where(svg):where(:not([fill])) {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke: currentColor;
}

:where(svg):where(:not([width])) {
  inline-size: 5rem;
}

:where(input, button, textarea, select),
:where(input[type="file"])::-webkit-file-upload-button {
  color: inherit;
  font-size: inherit;
  font: inherit;
  letter-spacing: inherit;
  word-spacing: inherit;
}

:where(textarea) {
  resize: block;
}

:where(p, h1, h2, h3, h4, h5, h6) {
  overflow-wrap: break-word;
}

:where(ul, ol) {
  list-style-position: inside;
}

:where(ul, ol, [role="list"]) {
  list-style: none;
}

:where(ul, ol, [role="list"]) li::before {
  border: 0px;
  clip: rect(0px, 0px, 0px, 0px);
  content: "\\200B";
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0px;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
}

:where(a[href], area, button, input, label[for], select, summary, textarea, [tabindex]:not([tabindex*="-"])) {
  cursor: pointer;
  touch-action: manipulation;
}
:where(input[type="file"]) {
  cursor: auto;
}
:where(input[type="file"])::-webkit-file-upload-button,
:where(input[type="file"])::file-selector-button {
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  :focus-visible {
    transition: outline-offset 145ms cubic-bezier(0.25, 0, 0.4, 1);
  }
  :where(:not(:active)):focus-visible {
    transition-duration: 0.25s;
  }
}
:where(:not(:active)):focus-visible {
  outline-offset: 5px;
}

:where(button, button[type], input[type="button"], input[type="submit"], input[type="reset"]),
:where(input[type="file"])::-webkit-file-upload-button,
:where(input[type="file"])::file-selector-button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  text-align: center;
  user-select: none;
}

:where(button, button[type], input[type="button"], input[type="submit"], input[type="reset"])[disabled] {
  cursor: not-allowed;
}

/**********
*** UTILITIES
**********/
.active-nav {
  background: var(--color-core-primary);
  color: var(--color-aux-950);
  text-decoration: underline;
}

.content-section {
  padding-block: var(--space-base-8x);
}

              
            
!

JS

              
                
              
            
!
999px

Console