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 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

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.

HTML

              
                      <div class="container">
            <div class="row">
                <div class="col-md-12 title">
                    <h1>Get Inspired!</h1>
                </div>
              <div class="col-md-12 creator">A learning Project by
                    <a href="https:www.github.com/vincanger" target="_blank">Vince Canger</a>
                </div>
                <div class="col-md-12 quoteArea">
                    <p id="randomQuote"></p>
                </div>
    
                <div class="col-md-12 buttons">
             
                    <button id="newQuote">Inspire Me, Baby!</button>
              </div>
            </div>
    </div>
    
  <!-- BOOTSTRAP JAVASCRIPT -->
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>

  <script src="app.js"></script>


              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap');



body{
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    background:#f0e9d1;
    color:rgb(196, 177, 71);
    padding: 0;
    margin: 0;
  }

  button {
  background-color: white;
  color: rgb(129, 196, 71);
  margin: 1% 20%;
}
  .title{
    padding-top:10px;
    text-align: center;
    margin-bottom: 0px;
  }
  .quoteArea{
    padding: 1%;
    font-size: 30px;
    border:5px solid #fff;
    margin: 0% 20%;
    color:rgb(196, 177, 71);
  }

  #qtitle {
    font-size: 18px;
    color: rgb(82, 74, 34);
    padding: 0;
    margin: 0;
  }

  #idea {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    padding: 0px 15px;
    /* border: 2px red solid; */
    margin: 0;
  }

  .creator, .creator a{
      text-align: center;
      padding-bottom: 10px;
  }

  a{
    color: rgb(129, 196, 71);
  }
              
            
!

JS

              
                // Random Inspiration Generator by Vince Canger

const goodIdeas = {
    newHabit: ['Drinking a glass of water', 'A cold shower', 'A healthier breakfast', 'Keeping your phone in the other room'],
    inspireQuote: [
      'And even if it\'s sunday may i be wrong </br> for whenever men are right they are not young - <i>ee cummings</i>', 
      'I think of the self-actualizing man not as an ordinary man with something added, <br> but rather as the ordinary man with nothing taken away<br>  -<i>Abraham Maslow</i>', 
      'Remember that sometimes not getting what you want<br> is a wonderful stroke of luck<br> - <i>Dalai Lama XIV</i>', 
      ],
    somethingNice: ['Say something nice to someone', 'Call a friend', 'Talk with a stranger', 'Listen when someone else is talking']
}

function randNumber(num) {
    return Math.floor(Math.random() * num)
}

let counter = 0;

const populateQuote = () => {
    let personalWisdom = [];

    for(let prop in goodIdeas) {
      let randIndex = randNumber(goodIdeas[prop].length)

      switch(prop) {
        case 'newHabit':
          personalWisdom.push(`<div id="qtitle">Every morning try:</div> <div id="idea">${goodIdeas[prop][randIndex]}</div><br>`)
          break
        case 'inspireQuote':
          personalWisdom.push(`<div id="qtitle">Inspiring Quote:</div> <div id="idea">${goodIdeas[prop][randIndex]}</div><br>`)
          break
        case 'somethingNice':
          personalWisdom.push(`<div id="qtitle">Do this good deed:</div> <div id="idea">${goodIdeas[prop][randIndex]}</div>`)
          break
        default:
          personalWisdom.push('yoyoyoyo')
      }
    }

    let wiseString = personalWisdom.join("");

    if (counter > 0){
        document.getElementById('newQuote').innerHTML = 'Even More!'
    } else {
        document.getElementById('newQuote').innerHTML = 'Gimme More!';
    }
    counter++;

    return document.getElementById('randomQuote').innerHTML = wiseString;
}
document.getElementById('newQuote').addEventListener('click', populateQuote);


              
            
!
999px

Console