Pen Settings



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


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.


                <div id="wrapper">
  <h1>Simple Text To Speech</h1>
  <p id="warning">Sorry, your browser does not support the Web Speech API.</p>  
  <textarea id="txtFld">I love the sound of my computer-generated voice.</textarea>
  <label for="txtFld">Type text above. Then click the Speak button.</label>
    <button type="button" id="speakBtn">Speak</button>
    <p>Note: For best results on a Mac, use the latest version of Chrome, Safari, or FireFox. On Windows, use Chrome.</p>


                @charset "UTF-8";
*, *:before, *:after {box-sizing: border-box;}
:root {
html {
  font-size: 16px;
  font-family: Trebuchet,sans-serif;
body {
  background: var(--accentcolor);
  color: var(--reversecolor);
  margin: 0;
  padding: 0;
  line-height: 1.5;
strong, b {font-weight: bold;}
#wrapper {
  margin: 0 auto;
  padding: 1.2rem;
  width: 100%;
  height: auto;
  min-width: 320px;
  max-width: 960px;
  background: var(--reversecolor);
  color: var(--textcolor);
  text-align: left;
  border:2px solid var(--accentcolor);
  border-radius:0 0 16px 16px;
  box-shadow:4px 4px 16px #333;
h1 {
  color: var(--accentcolor);
  font-size: 3rem; 
  margin: 0;
p {
  font-size: 1rem; 
  margin: 1rem 0 1rem 0;
a:link, a:visited {color: var(--accentcolor);}
a:hover {text-decoration: none;}

#numFld {
  font-size: 1.2rem;
  width: 4rem;
  text-align: right;
  padding: 0;
  margin: 0 0 0 4px;
#txtFld {
  width: 100%;
  height: 4.4rem;
  font-size: 1.6rem;
  font-family: inherit;
button {
  -webkit-appearance: none;
  font-size: 1.4rem;
  font-weight: normal;
  background: var(--lightaccentcolor);
  border-radius: 12px;
  border: 2px solid var(--accentcolor);
  color: var(--textcolor);
  padding: 0.3rem 0.5rem 0.3rem 0.5rem;
  cursor: pointer;
  margin: 10px 20px 10px 20px;
button:hover {
  color: var(--reversecolor);
  background: var(--accentcolor);
  cursor: not-allowed;
#warning {
  color: red;
  font-size: 1.4rem;
  display: none;


                let speakBtn, txtFld;
function init(){
  speakBtn = qs("#speakBtn");
  txtFld = qs("#txtFld");
  if (!window.speechSynthesis) {
    speakBtn.disabled = true;
    qs("#warning").style.display = "block";
function talk(){
  let u = new SpeechSynthesisUtterance();
  u.text = txtFld.value;
// Reusable utility functions
function qs(selectorText){
  //saves lots of typing for those who eschew Jquery
  return document.querySelector(selectorText);
document.addEventListener('DOMContentLoaded', function (e) {
  try {init();} catch (error){
    console.log("Data didn't load", error);}