Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <nav class="navbar navbar-expand navbar-light bg-light fixed-top mat-shadow">
  <div class="container-fluid">
    <a class="navbar-brand ripple" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mat-nav" ripple>
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="mat-nav">
    <ul class="navbar-nav">
      <li class="nav-item active">
        <a class="nav-link ripple" href="#">Home</a>
      </li>
      <li class="nav-item">
        <a class="nav-link ripple" href="#">Features</a>
      </li>
      <li class="nav-item">
        <a class="nav-link ripple" target="_blank" rel="noopener" href="https://getbootstrap.com">Get Bootstrap</a>
      </li>
    </ul>
    <a href="#" role="button" class="btn btn-primary btn-fill ripple ml-auto" data-toggle="offcanvas" menu-target="1"><span>Action</span>
    </a>
  </div>
  </div>  
</nav>

<section id="main-content">
  <div class="container text-center">
    <h2 class="py-5">Content</h2>
    <p class="mb-5">Please note that this could not work properly on Codepen,<br/> but in a project the scrollbar will be displayed over the content correctly.</p>
    <img src="https://static.thenounproject.com/png/496854-200.png" id="scroll" class="mt-5 pt-5" width="90px" alt="scroll">
  </div>
</section>
              
            
!

CSS

              
                /* General */
@font-face {
  font-family: 'Product Sans';
  font-style: normal;
  font-weight: 400;
  src: local("Open Sans"), local("OpenSans"), url(https://fonts.gstatic.com/s/productsans/v5/HYvgU2fE2nRJvZ5JFAumwegdm0LZdjqr5-oayXSOefg.woff2) format("woff2");
}
body{
  height: 100rem; /* Manual height for make scrollbar appear */
  font-family: 'Product Sans', sans-serif !important;
  overflow-y: overlay !important; /* For scrollbar overlay on content */
  overflow-x: hidden !important;
}
::selection{
    background: #5f97f6;
    color: white;
}
.btn:focus{
  outline: none;
  box-shadow: none !important;
}
.btn:active{
  background-color: #2979ff !important;
  border-color: #2979ff !important;
}
.btn-link{
  color: #9d9d9d;
  text-decoration: none;
}
.btn-link:hover{
  color: #448aff;
  text-decoration: none;
}
.btn-link:active{
  background-color: transparent !important;
  border: none;
  text-decoration: none;
}
.mat-shadow{
  box-shadow: 0 3px 6px rgba(0, 0, 0, .16), 0 3px 6px rgba(0, 0, 0, .23);
}
.back-white{
  background-color: white;
}
.on-top{
  z-index: 1050;
}
.pointer{
  cursor: pointer;
}

/* Material button color */
.btn-primary{
  background-color: transparent;
  border-radius: 4px;
  border: 2px solid #448aff;
  color: #448aff;
}
.btn-primary:hover{
  background-color: #448aff;
  border: 2px solid #448aff;
}

/* Material Ripple effect */
.ripple{
	position: relative;
	overflow: hidden;
}
.effect{
	position: absolute;
	border-radius: 100%;
	background-color: rgba(255, 255, 255, .2);
	opacity: 0;
	animation: effect .6s ease-in;
}
@keyframes effect{
	0%{opacity:1;transform:scale(0);}
	80%{opacity:.2;}
	100%{opacity:0;transform:scale(3);}
}

.btn-fill{
  position: relative;
  color: #448aff;
  border: 2px #448aff solid;
  border-radius: 4px;  
  outline: 0;
  overflow: hidden;
  background: transparent;
  transition: .2s ease-in-out;
  -o-transition: .2s ease-in-out;
  -ms-transition: .2s ease-in-out;
  -moz-transition: .2s ease-in-out;
  -webkit-transition: .2s ease-in-out;
  cursor: pointer;
}
.btn-fill:hover{
  color: white;
  background-color: transparent;
}
.btn-fill:before{
  content: '';
  position: absolute;
  background: #448aff;
  bottom: 0;
  left: 0;
  right: 0;
  top: 100%;
  z-index: -1;
  -webkit-transition: top .2s ease-in-out;
}
.btn-fill:hover:before{
  top: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: .45rem;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(27, 27, 27, .4);
    border-radius: 3px;
}
::-webkit-scrollbar-track{
    background: transparent;
}

/* Navbar */
#navbar{
  width: 100vw;
}

#scroll{
  opacity: .7;
}
              
            
!

JS

              
                //Init
$(document).ready(function(){
  init();
});

function init(){
  //Auto margin calculator
  var navbarHeight = $("nav").height();
  var paddingTop = parseInt($("nav").css('padding-top'));
  var paddingBottom = parseInt($("nav").css('padding-bottom'));
  $('#main-content').css('margin-top', (navbarHeight + paddingTop + paddingBottom) + 'px');
    
  //Ripple
  var ripples = document.querySelectorAll('.ripple');
	for (var i = 0; i < ripples.length; i++) {
		ripples[i].addEventListener('mousedown', rippleEffect, false);
	}

	function rippleEffect(e){
		var width = this.clientWidth;
		var height = this.clientHeight;
		var rect = this.getBoundingClientRect();
		var posX = e.clientX - rect.left;
		var posY = e.clientY - rect.top;
		var size = Math.max(width, height);
		var effect = document.createElement('DIV');
		effect.className = 'effect';
		effect.style.width = size + 'px';
		effect.style.height = size  + 'px';
		effect.style.top = posY - size/2 + 'px';
		effect.style.left = posX - size/2 + 'px';

		this.appendChild(effect);
		var parent = this;
	  
		setTimeout(function() {
			parent.removeChild(effect);
		}, 750);
	}
  
  //Prevent horizontal scroll of page using keyboard
  $(window).keydown(function(e){
    if(e.which == 37 || e.which == 39){
      e.preventDefault();
    }
  });
  
  //Scroll hide image
  $(window).scroll(function () {
    $(this).scrollTop() > 50 ? $('#scroll').fadeOut() : $('#scroll').fadeIn()
  });
}
              
            
!
999px

Console