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.


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.


                <!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <style media="screen">
				background: #cdedf5;
        font-family: sans-serif;
				background: white;
				position: absolute;
				transform: translateX(-50%) translateY(-50%);
				width: 370px;
				box-shadow: 0 0 10px 0 #ccc;
      .container h3{
        text-align: center;
        font-size: 27px;
        margin-top: -10px;
        color: #0512c5
			.container textarea{
				width: 365px;
				min-height: 140px;
				resize: none;
				outline: none;
				border: 1.5px solid #085bc8;
			.container label{
				display: block;
				width: 400px;
			.container label span{
				width: 100px;
				margin-top: 20px;
				display: inline-block;
      .container select{
        height: 30px;
			.container label select, .container label input{
				width: 260px;
				display: inline-block;
				background: #0869f1;
				padding: 13px 40px;
				color: white;
				border: 1px solid #ccc;
				cursor: pointer;
				margin-top: 20px;
        margin-left: 32%;
        font-size: 18px;
        border: none;
        border-radius: 3px;
				box-shadow: 4px 4px 10px 0 #ccc;
		<div class="container">
			<h3>Text to Speech</h3>
			<textarea style="font-size:17px" id="myText">This is a Text to Speech project. It can convert your input text to voice</textarea>
				<select id="voiceOptions"></select>
				<input id="volumeSlider" type="range" min="0" max="1" value="0.5" step="0.1"/>
				<input id="rateSlider" type="range" min="0" max="1" value="0.5" step="0.1"/>
				<input id="pitchSlider" type="range" min="0" max="2" value="0.5" step="0.1"/>
			<div id="button">Speak</div> 

    <script type="text/javascript">
//If your browser is not updated or not supported, you can see the alert message below
if (!('speechSynthesis' in window)) {
	alert('Your browser is not supported. If google chrome, please upgrade!!');
//The global constant of some id functions has been determined.
//Because no html function can be used directly in JavaScript
var myText = document.getElementById('myText'),
	voiceOptions = document.getElementById('voiceOptions'),
	volumeSlider = document.getElementById('volumeSlider'),
	rateSlider = document.getElementById('rateSlider'),
	pitchSlider = document.getElementById('pitchSlider'),
	voiceMap = [],
	btn = document.getElementById('button');

function loadVoices() {
	'use strict';
  //A speech synthesizer is a computerized device that accepts input, interprets data, and produces audible language.
	var voices = speechSynthesis.getVoices(),
	for (i = 0; i < voices.length; i += 1) {
		voice = voices[i];
		option = document.createElement('option');
		option.value =;
		option.innerHTML =;
		voiceMap[] = voice;
//The SpeechSynthesis interface of the Web Speech API is the controller interface for the speech service
//The onvoiceschanged property of the SpeechSynthesis interface
window.speechSynthesis.onvoiceschanged = function (e) {
	'use strict';
//Now you need to activate the control buttons
btn.onclick = function () {
	'use strict';
	var msg = new SpeechSynthesisUtterance();
	msg.volume = volumeSlider.value;
	msg.voice = voiceMap[voiceOptions.value];
	msg.rate = rateSlider.value;
	msg.pitch = pitchSlider.value;
	msg.text = myText.value;