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.

              <div class="container">
  <div class="ball">
    <div class="hole">
      <div class="message-holder">
        <div class="glass">
          <p id="message">
            Welcome To Magic Eight Ball
body {
  background: rgb(238,14,202);
  background: radial-gradient(circle, rgba(238,14,202,1) 20%, rgba(0,0,0,1) 100%);
 height: 100%;

.container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;

.ball {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0,0,0);
  background: linear-gradient(315deg, rgba(0,0,0,1) 80%, rgba(120,120,120,.75) 98%); 
  width: 500px;
  height: 500px;
  border-radius: 100%;
  box-shadow: inset -25px -15px 30px rgba(90,90,90,.3);
  transition: margin .25s ease-in;

.hole {
  position: relative;
  height: 190px;
  width: 190px;
  background: rgb(250,250,250);
  background: linear-gradient(120deg, rgba(250,250,250,.1) 5%, rgba(18,2,55,.95) 20%); 
  border: -10px solid black;
  border-radius: 100%;


.glass {
  position: absolute;
  background: rgb(250,250,250);
  background: linear-gradient(120deg, rgba(250,250,250,.1) 5%, rgba(18,2,55,.95) 20%); 
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 100%;
  -webkit-filter: blur(1px);
  filter: blur(1px);
  z-index: 9999;

.message-holder {
  float: left;
  margin-top: 45px;
  margin-left: 20px;
  width: 0; 
  height: 0; 
  border-left: 75px solid transparent;
  border-right: 75px solid transparent;  
  border-top: 135px solid #a2a2a2;
  transition: opacity 2s ease-in-out;

#message {
  color: white;
  font-size: 18px;
  text-align: center;
  margin: 60px auto;
  width: 50%;
  transition: opacity 2.5s ease-in;

.shake {
  animation: shake 4s cubic-bezier(.36,.07,.19,.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  20%, 80% {
    transform: translate3d(2px, 0, 0);

  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);

  40%, 60% {
    transform: translate3d(4px, 0, 0);

              const holder = document.querySelector('.message-holder')
const message = document.querySelector('#message');
const ball = document.querySelector('.ball');
const messages = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful" ]

fadeInAnimation = function(){  
    ball.classList.remove('shake'); = 1; = 1;
    message.innerHTML = messages[Math.floor(Math.random()*messages.length)];
  }, 4000)

fadeOutAnimation = function(callback){ = 0; =0;  

ball.addEventListener('click', function() {

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