Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>ARIA-live demo</title>
</head>

<body>
<main>
<h1>ARIA-live demo</h1>

<section aria-label="Controllers" id="controllers">
<button aria-controls="live-region" type="button">Refresh live region instantly</button>
<button aria-controls="non-live-region" type="button">Refresh non-live region instantly</button>
<button aria-controls="live-region" data-delay="true" type="button">Refresh live region after a few seconds</button>
<button aria-controls="non-live-region" data-delay="true" type="button">Refresh non-live region after a few seconds</button>
</section>

<section aria-labelledby="live-region-heading">
<h2 id="live-region-heading">Live region</h2>
<div id="live-region" aria-live="polite"></div>
</section>

<section aria-labelledby="non-live-region-heading">
<h2 id="non-live-region-heading">Non-live region</h2>
<div id="non-live-region"></div>
</section>
</main>

<div class="visuallyhidden" id="screen-reader-message" role="status"></div>
</body>
</html>

            
          
!

CSS

            
              /*
Code for the visuallyhidden class was retrieved from:
https://webaim.org/techniques/css/invisiblecontent/
*/ 
.visuallyhidden {
 clip: rect(1px, 1px, 1px, 1px);
 clip-path: inset(50%);
 height: 1px;
 width: 1px;
 margin: -1px;
 overflow: hidden;
 padding: 0;
 position: absolute;
}

            
          
!

JS

            
              const controllerButtons = document.querySelectorAll('#controllers button');
const screenReaderMessage = document.getElementById('screen-reader-message');
const sequences = [
 `Fibonacci Sequence: 0. 1. 1. 2. 3. 5. 8. 13. 21. 34. 55. 89. 144. 233. 377. 610. 987. 1597. 2584. 4181. 6765. 10946. 17711. 28657. 46368. 75025. 121393. 196418. 317811. 514229. 832040. 1346269. 2178309. 3524578. 5702887. 9227465. 14930352. 24157817. 39088169. 63245986. 102334155. 165580141. 267914296. 433494437. 701408733. 1134903170. 1836311903. 2971215073. 4807526976. 7778742049. ... Phew! At this point, the Golden Ratio is 1.618033988749895!`,
 `Kolakoski Sequence: 1. 2. 2. 1. 1. 2. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 1. 2. 2. 1. 2. 1. 1. 2. 1. 2. 2. 1. 1. 2. 1. 1. 2. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 2. 2. 1. 2. 1. 1. 2. 1. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 1. 2. 1. 2. 2. 1. 2. 1. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 2. 2. 1. 2. 2. 1. 1. 2. 1. 1. 2. 2. ... how interesting!`,
 `Prime Numbers: 2. 3. 5. 7. 11. 13. 17. 19. 23. 29. 31. 37. 41. 43. 47. 53. 59. 61. 67. 71. 73. 79. 83. 89. 97. 101. 103. 107. 109. 113. 127. 131. 137. 139. 149. 151. 157. 163. 167. 173. 179. 181. 191. 193. 197. 199. 211. 223. 227. 229. 233. 239. 241. 251. 257. 263. 269. 271. 277. 281. 283. 293. 307. 311. 313. 317. 331. 337. 347. 349. 353. 359. 367. 373. 379! Woop woop! That was a complete sequence of 75 prime numbers!`,
 `Count from 0 to 100: 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100! Incredible!`,
];
let indexOfCurrentSequence = 0;

controllerButtons.forEach(element => {
 const controlledRegion = document.getElementById(element.getAttribute('aria-controls'));
 const delayedAction = element.getAttribute('data-delay') === 'true';
 const action = () => {
  sequence = sequences[indexOfCurrentSequence];
  controlledRegion.textContent = sequence;
  if (controlledRegion.id === 'non-live-region') screenReaderMessage.textContent = `Now showing ${sequence.slice(0, sequence.indexOf(':'))} in the non-live region.`;
  if (++indexOfCurrentSequence === sequences.length) indexOfCurrentSequence = 0;
 };
 element.addEventListener('click', event => {
  if (delayedAction) {
   controllerButtons.forEach(button => button.disabled = true);
   setTimeout(() => {
    action();
    controllerButtons.forEach(button => button.disabled = false);
   }, Math.floor(Math.random() * 5000) + 2000);
  }
  else action();
 });
});
controllerButtons[0].focus();
            
          
!
999px

Console