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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <html>

<div class='container'>
  <div class='content'>
    <h3 class='title'>Florin Pop's #weeklyCodingChallenge Week #3</h3>
    <p class='attribution'>Submission by Ashton Christensen</p>
  </div>
  <div class='nav'>
    <div class='btn home active'>
      <span class='notclicked'></span>
      <p class='home'>Home</p>
    </div>
    <div class='btn profile'>
      <span class='notclicked'></span>
      <p class='profile'>Profile</p>
    </div>
    <div class='btn search'>
      <span class='notclicked'></span>
      <p class='search'>Search</p>
    </div>
    <div class='btn settings'>
      <span class='notclicked'></span>
      <p class='settings'>Settings</p>
    </div>
  </div>
</div>
</html>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat:500|Roboto" rel="stylesheet');

html {
  display: flex;
  justify-content: center;
  background: linear-gradient(45deg, rgba(255,66,222,1) 0%, rgba(255,177,66,1) 100%);
}


.container {
  margin: 5px 5px 5px 5px;
  position: relative;
  width:300px;
  height:450px;
  border: transparent 5px solid;
  border-radius: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-content: center;
  background-color: white;
  box-shadow: 5px 5px 1px #111;
  background-color: #afafaf;
}

.content {
  height: 390px;
}

.title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  color:#2F2F2F;
  font-size: 22px;
}
.attribution {
  font-family: 'Roboto', sans-serif;
  color:#2F2F2F;
}
.nav {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  background-color:#E2E2E2;
  height: 60px;
  border-radius: 10px;
  width: inherit;
  overflow: hidden;
}

.btn {
  z-index:2;
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: black;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: font-size .15s ease-in;
}
.active {
  font-size: 16px;
  background: -webkit-linear-gradient(90deg, rgba(255,66,222,1) 0%, rgba(255,177,66,1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn:hover {
  font-size: 16px;
}
.notclicked {
  position:absolute;
  z-index: 1;
  height: 50px;
  width: 50px;
  background-color: rgba(0,0,0,0);
  border-radius: 50%;
  transform: scale(1);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 1);
}
.clicked {
  position:absolute;
  z-index: 1;
  height: 1px;
  width: 1px;
  background-color: rgba(0,0,0,0);
  border-radius: 50%;
  transform: scale(1);
  box-shadow: 1 1 1 1 rgba(0, 0, 0, 1);
  animation: click 1s;
}

.align {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@keyframes click {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 40px rgba(0,0,0,0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(70,70,70,0);
  }
}

              
            
!

JS

              
                const buttons = document.querySelectorAll('.btn');
const container = document.querySelector('.container');

//makes a new random hexadecimal color
function newBackground() {
  let newColor = '#';
  var possible = "ABCDEF0123456789";

  for (var i = 0; i < 6; i++)
    newColor += possible.charAt(Math.floor(Math.random() * possible.length));
  console.log(newColor);
  return newColor;
}

//button event listener
buttons.forEach(clickedButton => {
  clickedButton.addEventListener('click', () => {
    buttons.forEach(button => {
      button.classList.remove('active');
    });    
    
    //turns clicked button to active(orange)
    clickedButton.classList.add('active');
    
    //creates animation class in empty span under button
    let newDot = clickedButton.querySelector('span');
    newDot.classList.remove('notclicked');
    
    //changes background to new random color
    container.style.background = newBackground();
    
    //activates animation and deactivates for next time
    newDot.classList.add('clicked');
    setTimeout(() => {
      newDot.classList.remove('clicked');
      newDot.classList.add('notclicked');
    }, 1000);
    
  })
})
              
            
!
999px

Console