cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="box">
  <h1 class='header'>Random Insults Generator</h1>
  <p class="instructions">Click the button below to generate a random insult.</p>
  <p class='paragraph'><em>Insults will appear here</em></p>
  <div class="btn" onclick="myFunction()"><p class="btn-text">Insult!</p></div>
</div>


            
          
!
            
              body{
  background: url('https://www.toptal.com/designers/subtlepatterns/patterns/geometry.png');
}
.box{
  width: 90%;
  max-width: 700px;
  height: 300px;
  margin: 20px auto;
  padding: 10px;
/*   background: #333; */
  font-family: sans-serif;
  padding: 15px;
  text-align: center;
  color: white;
  border-radius: 10px;
  display:flex;
  flex-flow: column;
  align-items: center;
  background: rgba(102, 0, 102,.75)
}
.paragraph{
  background: #111;
  width: 90%;
  margin: 20px auto;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold
}
.paragraph p{

}
.btn{
  background: rgb(0, 102, 102);
  width: 100px;
  padding: 5px;
  border-radius: 10px;
  display: flex;
  justify-content: center; 
  cursor: pointer
  transition: all .3s ease;
}
.btn:hover{
  background: rgb(10, 112, 112);
}
.btn p{
  font-weight:bold;
  padding: 0;
}
            
          
!
            
              var adj = ['stinky','ugly'];
var noun1 = ['giraffe','warthog'];
var noun2 = ['rump','snout','flank','hoof','tooth','tail','fur','leg','fang'];
var insult = '';

function rand(thing){
 return thing[Math.floor(Math.random() * thing.length)];
}

function myFunction(){
  insult = '';
  document.getElementsByClassName("paragraph")[0].innerHTML = insult;
}
            
          
!
999px
Loading ..................

Console