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

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

              
                <div class="button_container">
	<button class="btn"><span>HOVER ME!</span></button>
  <p> Made for <a href="https://creatiffish.com/blog/2020/01/07/css-tutorial-5-cool-css-button-designs-with-hover-effects/"> this blog post</a> </p>
</div>
              
            
!

CSS

              
                
.button_container {
  
  /* Button position on the screen */
	position: absolute;
  left: 0;
  right: 0;
  top: 20%;
}


.btn {
  /* Removes default button border */
  border: none;
  display: block;
  /* Centralized the text */
  text-align: center;
  /* Changes to cursor to a pointer */
  cursor: pointer;
  /* Hides the skewed box, only showing it within the button */
  overflow: hidden;
  position: relative;
  /* White text color and bold font*/
  color: #fff;
  font-weight: 700;
  /* Text size */
  font-size: 15px;
  /* Black background color */
  background-color: #222;
  /* Some space around the text */
  padding: 17px 60px;
  /* Horizontally centers the button */
  margin: 0 auto;
  /* Faint box shadow to give a pop-up effect */
  box-shadow: 0 5px 15px rgba(0,0,0,0.20);
}

.btn span {
  position: relative; 
  /* Brings the text to the top of the screen. A higher z-index means it gets displayed on top of other elements. When the skewed line slides over it, the text stays on top */
  z-index: 1;
}

/* Creating the skewed sliding line. This is actually a box, but will be partially hidden */
.btn:after {
  content: "";
  position: absolute;
  /* Position of the skewed line*/
  left: 0;
  top: 0;
  /* Size of the skewed line*/
  height: 490%;
  width: 140%;
  /* Background color of the skewed line */
  background: #78c7d2;
  /* Duration of the slide */
  -webkit-transition: all .5s ease-in-out;
  transition: all .5s ease-in-out;
  
  /* makes the line skewed/slanted. Without this, it will be a straight line */
  -webkit-transform: translateX(-98%) translateY(-25%) rotate(45deg);
  transform: translateX(-98%) translateY(-25%) rotate(45deg);
}

.btn:hover:after {
  /* Moves the skewed line when the button is hovered */
  -webkit-transform: translateX(-9%) translateY(-25%) rotate(45deg);
  transform: translateX(-9%) translateY(-25%) rotate(45deg);
}

p {
  margin: auto;
  position: absolute;
  left: 40%;
  top: 200%;
  right: 0;
  color: white;
}
p > a{
  color: white;
}
              
            
!

JS

              
                
              
            
!
999px

Console