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

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="container">
  <h1>CSS3 Buttons <span>Hover</span> Effects</h1>
  <div class="subheader">(hover to check effect)</div>
  
  <div class="link">
    <a href="https://github.com/eisenfox/css3-btns-hover" title="Check on GitHub" target="_blanc"><i class="far fa-star"></i>Check on GitHub</a>
    <a href="http://100dayscode.co.uk/" title="Check Codepen Challenge" target="_blanc"><i class="far fa-star"></i>Check Codepen Challenge</a>
  </div>
   
   <div class="content-block">
    
    <!-- effect #1-->
    <div class="content-block__effect">
      <h2>Effect #1</h2>
      
      <div class="btn-block">
        
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-1" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-1" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-1" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-1" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-1" title="View More">View More</a>
        
      </div>
    </div>
    
     <!-- effect #2-->
    <div class="content-block__effect">
      <h2>Effect #2</h2>
      
      <div class="btn-block">
        
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-2" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-2" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-2" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-2" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-2" title="View More">View More</a>
        
      </div>
    </div>
    
    <!-- effect #3-->
    <div class="content-block__effect">
      <h2>Effect #3</h2>
      
      <div class="btn-block">
        
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-3" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-3" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-3" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-3" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-3" title="View More">View More</a>
        
      </div>
    </div>
    
    <!-- effect #4-->
    <div class="content-block__effect">
      <h2>Effect #4</h2>
      
      <div class="btn-block">
        
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-4" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-4" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-4" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-4" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-4" title="View More">View More</a>
        
      </div>
    </div>
    
    <!-- effect #5-->
    <div class="content-block__effect">
      <h2>Effect #5</h2>
      
      <div class="btn-block">
        
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-5" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-5" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-5" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-5" title="View More">View More</a>
        <a href="#" class="btn-hover-effect btn-hover-effect--effect-5" title="View More">View More</a>
        
      </div>
    </div>
    
  </div>
</div>
              
            
!

CSS

              
                //VARIABLES
$accent-theme-color: #119DA4;

$btn-bg-1: #880044;
$btn-bg-2: #28AFB0;
$btn-bg-3: #D78521;
$btn-bg-4: #745296;
$btn-bg-5: #3E8914;

$btn-hover-effect-padding-vert: 22px;
$btn-hover-effect-padding-horz: 36px;
$icon-block-width: 40px;

//MIXINS

//transitions mixin
@mixin transition-mix($property: all, $duration: 0.2s, $timing: linear, $delay: 0s) {
  transition-property: $property;
  transition-duration: $duration;
  transition-timing-function: $timing;
  transition-delay: $delay;
}

//position absolute mixin
@mixin position-absolute ($top: null, $left: null, $right: null, $bottom: null) {
  position: absolute;
  top: $top;
  left: $left;
  right: $right;
  bottom: $bottom;
}

/* common styles !!!YOU DON'T NEED THEM  */
body {
  font: {
    family: 'Hind', sans-serif;;
    size: 16px;
  }
}

.container {
  width: 950px;
  margin: 50px auto 0px auto;
  text-align:  center;
}

h1 {
  margin: 0;

  font: {
    weight: 400;
    size: 35px;
  }

  span {
    font: {
      family: 'Bad Script', cursive;
      weight: bold;
    }
    text-decoration: underline wavy;
    color: $accent-theme-color;
  }
}

.link {
  display: flex;
  justify-content: center;
  width: 80%;
  margin: 30px auto 0;

  a {
    margin-right: 20px;
    
    color: #1f1f1f;
    font: {
      size: 17px;
    }
    display: inline-block;
    
    &:last-child {
      margin-right: 0;
    }

    i {
      color: $accent-theme-color;
      margin-right: 5px
    }
  }
}

.content-block {
  margin-top: 50px;
  
  h2 {
    margin-bottom: 30px;
  }
}

.content-block__effect {
  margin-bottom: 50px;
}

.btn-block {
  display: flex;
  justify-content: space-between;
}

.btn-hover-effect {
  display: flex;
  
  font: {
    family: Arial;
    size: 17px;
  }
  color: #fff;
  letter-spacing: 1px;
  line-height: 1;
  
  &:nth-child(1) {
    background-color: $btn-bg-1;
  }
  
  &:nth-child(2) {
    background-color: $btn-bg-2;
  }
  
  &:nth-child(3) {
    background-color: $btn-bg-3;
  }
  
  &:nth-child(4) {
    background-color: $btn-bg-4;
  }
  
  &:nth-child(5) {
    background-color: $btn-bg-5;
  }
}

/* effects styles !!!YOU NEED THEM */

/* don't forget to add your own background-color and text color */
.btn-hover-effect {
  @include transition-mix();
  
  position: relative;
  
  display: flex;
  align-items: center;
  padding: $btn-hover-effect-padding-vert $btn-hover-effect-padding-horz;
  
  transform: translateZ(0);
  
  text-decoration: none;
  
  overflow: hidden;
}

/* effect 1 styles */
.btn-hover-effect--effect-1 {  
  
  /* overlay block styles */
  &:before {
    @include position-absolute($top: 0, $left: 0);
    @include transition-mix($property: transform);
    
    display: block;
    width: 100%;
    height: 100%;
    
    content: '';
    
    background-color: rgba(255,255,255, .2);
    
    transform: scale(0, 1);
    transform-origin: right top;
    
    z-index: -1;
  }
  
  /* icon styles */
  &:after {
    @include position-absolute($top: 1px, $right: (- $icon-block-width));
    @include transition-mix();
    
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: $icon-block-width;
    
    content: '\f105';
    
    font: {
      family: "Font Awesome 5 Free";
      size: 25px;
      weight: 900;
    }
    line-height: inherit;
    
    opacity: 0;
  }
  
  //hover styles
  &:hover {
    padding-left: $btn-hover-effect-padding-horz - 10;
    padding-right: $btn-hover-effect-padding-horz + 10;
    
    &:before {
      transform: scale(1, 1);
      
      transform-origin: left top;
    }
    
    &:after {
      right: 0;
      
      opacity: 1;
    }
  }
  
}

/* effect #2 */
.btn-hover-effect--effect-2 {
  
  /* overlay styles */
  &:before {
   @include position-absolute($top: 50%, $left: 50%);
   @include transition-mix($property: transform);
    
    display: block;
    width: 200%;
    height: 200%;
    
    content: '';
    
    transform: translate(-50%, -50%) scale(0);
    transform-origin: center top;
    
    background-color: rgba(255,255,255, .2);
    border-radius: 50%;
   
    z-index: -1;
  }
  
  /* icon styles */
  &:after {
    @include position-absolute($top: 1px, $right: 0);
    
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: $icon-block-width;
    
    content: '\f105';
    
    font: {
      family: "Font Awesome 5 Free";
      size: 25px;
      weight: 900;
    }
    line-height: inherit;
    
    transform: scale(1.5);
    
    opacity: 0;
  }
  
  &:hover {
    padding-left: $btn-hover-effect-padding-horz - 10;
    padding-right: $btn-hover-effect-padding-horz + 10;
    
    &:before {
      transform: translate(-50%, -50%) scale(1);

      transform-origin: center bottom;
    }
    
    &:after {
      @include transition-mix();
      
      transform: scale(1);
      
      opacity: 1;
    }
  }
  
}

/* effect #3 */
.btn-hover-effect--effect-3 {
  
  /* overlay styles */
  &:before{
   @include position-absolute($top: 0, $left: 0);
   @include transition-mix($property: transform);
    
    display: block;
    width: 100%;
    height: 100%;
    
    content: '';
    
    transform: scale(1, 0);
    transform-origin: center bottom;
    
    background-color: rgba(255,255,255, .15);
    
    z-index: -1;
  }
  
  /* icon styles */
  &:after {
    @include position-absolute($top: 0, $left: 0);
    @include transition-mix($property: transform, $delay: .2s);
    
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    
    content: '\f30b';
    
    font: {
      family: "Font Awesome 5 Free";
      size: 30px;
      weight: 900;
    }
    line-height: inherit;
    color: transparent;
    
    transform: scale(1, 0);
    transform-origin: center bottom;
    
    background-color: rgba(255,255,255, .15);
  }
  
  &:hover {
    color: transparent;
    
    &:before {
      transition-duration: .15s;
      
      transform: scale(1, 1);
      transform-origin: center top;
    }
    
    &:after {
      transition-duration: .15s;
      
      transform: scale(1, 1);
      transform-origin: center top;
      
      color: #fff;
    }
  }
}

/* effect #4 */
.btn-hover-effect--effect-4 {
  
  /* overlay styles */
  &:before {
   @include position-absolute($top: 0, $left: 0);
   @include transition-mix($property: transform);
    
    display: block;
    width: 300%;
    height: 300%;
    
    content: '';
    
    transform: scale(.5);
    transform-origin: center center;
    
    background-color: rgba(255,255,255, .2);
    
    border-radius: 50%;
    
    z-index: -1;
  }
  
  /* icon styles */
  &:after {
    @include position-absolute($top: 0, $left: 0);
    
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    
    content: '\f30b';
    
    font: {
      family: "Font Awesome 5 Free";
      size: 30px;
      weight: 900;
    }
    line-height: inherit;
    color: transparent;
    
    transform: scale(1.4);
  }
  
  &:hover {
    color: transparent;
    
    &:before {
      transform: scale(2);
      transform-origin: center center;
    }
    
    &:after {
      @include transition-mix($delay: .2s);
      
      color: #fff;
      
      transform: scale(1);
    }
  }
}

/* effect #5 */
.btn-hover-effect--effect-5 {
  
  /* overlay styles */
  &:before {
   @include position-absolute($top: 50%, $left: 50%);
   @include transition-mix($property: transform);
    
    display: block;
    width: 300px;
    height: 300px;
    
    content: '';
    
    transform: translate(-50%, -50%) scale(0);
    transform-origin: center center;
    
    background-color: rgba(255,255,255, .15);
    border-radius: 50%;
    
    z-index: -1;
  }
  
  /* icon styles */
  &:after {
    @include position-absolute($top: 50%, $left: 50%);
    transition: transform .2s linear .2s, opacity .2s linear .2s;
    
    display: flex;
    align-items: center;
    justify-content: center;
    width: 300px;
    height: 300px;
    
    content: '\f30b';
    
    font: {
      family: "Font Awesome 5 Free";
      size: 30px;
      weight: 900;
    }
    line-height: inherit;
    color: transparent;
    
    transform: translate(-50%, -50%) scale(0);
    transform-origin: center center;
    
    background-color: rgba(255,255,255, .15);
    border-radius: 50%;
    opacity: 0;
    
    z-index: -1;
  }
  
  &:hover {
    
    color: transparent;
    
    &:before {
      transition-duration: .15s;
      
      transform: translate(-50%, -50%) scale(1);
      
      opacity: 1;
    }
    
    &:after {
      transition-duration: .15s;
      
      transform: translate(-50%, -50%) scale(1);
      opacity: 1;
      
      color: #fff;
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console