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 class="container">
        <div id="text-box" class="text-box">
           <h1>Speech Text Reader</h1>
            <h2>Select voice and Language</h2>
            <select id="voices"></select>
            <textarea id="text" placeholder="Enter text here"></textarea>
            <button class="btn" id="read">Speak Text</button>



                body {
/*   background-color: #296ca8; */
  background-image: linear-gradient(
        rgba(247, 247,247,1) 23.8%,
        rgba(135, 190, 226, 0.513) 92%
     height: 150vh;

#text::placeholder {
   font-size: 40px;
   color: #4992d3;
   text-align: center;
   padding-top: 10px;

.text-box {
    width: 50%;
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, 0);
    background-color: #4992d3;
    color: #fff;
    padding: 20px;
    border-radius: 25px;
    transition: all 1s ease-in-out;

.text-box select {
    background-color: #dedede;
    color: black;
    font-size: 12px;
    font-weight: bold;
    height: 30px;
    width: 60%;
    border-radius: 25px;

.text-box textarea {
    border: 1px #dadada solid;
    border-radius: 25px;
    font-size: 16px;
    padding: 8px;
    margin: 15px 15px;
    width: 95%;
    height: 80px;

.text-box .btn {
    width: 25%;
    height: 37px;
    font-size: 15px;
    color: #fff;
    background-color: #4992d3;
    border-radius: 100px;
    outline: none;

h1 {
    text-align: center;



                const voicesSelect = document.getElementById('voices')
const textarea     = document.getElementById('text');
const readBtn      = document.getElementById('read');

// create an instance of speech synthesis
let message = new SpeechSynthesisUtterance();

// Create an array to Store voices in current device
let voices = [];

// hook changed voice event, get all available voices for current device
speechSynthesis.addEventListener('voiceschanged', () => {
   voices = speechSynthesis.getVoices(); 

   voices.forEach((voice) => {
       const option = document.createElement('option');
       option.value =;
       option.innerText =;

// hook selected voice from list and set it
voicesSelect.addEventListener('change', (e) => {
    message.voice = voices.find(voice => ===;

// hook read buttonm set message from textarea and play the message
readBtn.addEventListener('click', () => {
   message.text = text.value;