123

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<body>
 <div id="maincenter">
   <img id="starfleet" src="http://img15.deviantart.net/1194/i/2010/152/5/a/tos_enterprise_by_trekmodeler.jpg" width="152" height="148">
 <p id="demo">To bodly go...</p>
   
<div class="container row">
 
  <button type="button" class="btn btn-default col-sm-2 col-sm-offset-2" onclick="myFunction()">Engage</button>
   </div>
  <a href="https://twitter.com/intent/tweet?text=I have a chronic fear of clicking buttons" target=_blank id="abc"><img src="https://cdn1.iconfinder.com/data/icons/logotypes/32/twitter-128.png" alt="tweet me" style="width:40px;height:40px;"></a>


</div>
</body>

            
          
!
            
              body{
  background-image: url("http://wallpapercave.com/wp/0Xf6Hpa.jpg");
}
#maincenter{
  background-color: lightblue;
  border-style: solid;
  border-color: white;
  width: 600px;
  margin:0 auto;
  margin-top: 50px;
}
#starfleet{
 display:block;
    margin:auto;
  margin-top:10px;
}
p{
  height: 40px;
  display:block;
    text-align: center;
}
.btn btn-default{
  display:block;
    margin:auto;
}



            
          
!
            
              var quotes = ["How we deal with death is at least as important as how we deal with life. -Captain Kirk",

"They used to say that if Man was meant to fly, he’d have wings. But he did fly. He discovered he had to. -Captain Kirk",
"The prejudices people feel about each other disappear when they get to know each other. -Captain Kirk",
"Conquest is easy. Control is not. -Captain Kirk",
"Without freedom of choice there is no creativity. The body dies. -Captain Kirk",
"Death. Destruction. Disease. Horror. That’s what war is all about. That’s what makes it a thing to be avoided. -Captain Kirk",
"One can begin to reshape the landscape with a single flower. -Spock",
"Change is the essential process of all existence. - Spock",
"Insults are effective only where emotion is present. -Spock",
"It is the lot of 'man' to strive no matter how content he is. -Spock",
"Logic is the beginning of wisdom, not the end. -Spock"];

var images = [];
var norepeat = 0;

function myFunction() {
 var arrnum = Math.floor(Math.random() * 11);
  if (norepeat != arrnum){
    norepeat = arrnum;
  var tweetme = "https://twitter.com/intent/tweet?text=" + quotes[arrnum];
  
 document.getElementById("demo").innerHTML = quotes[arrnum];
  
  
  if(arrnum < 7){
  document.getElementById("starfleet").src = "http://www.startrek.com/legacy_media/images/200307/kirk01/320x240.jpg";}else{
    document.getElementById("starfleet").src = "http://www.call-with-current-continuation.org/star-trek-spock1.jpg";
  }
  
  document.getElementById("abc").href=tweetme; 
    return false;
  }else{
    document.getElementById("starfleet").src = "http://www.startrek.com/legacy_media/images/200307/scott03/320x240.jpg"
    var tweetme = "https://twitter.com/intent/tweet?text=I'm giving it all she's got! -Scotty";
    document.getElementById("demo").innerHTML = "I'm giving it all she's got! -Scotty";
    document.getElementById("abc").href=tweetme; 
  }
  
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console