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

              
                <h1> Button effects </h1>

<div class="container">
  <button class="button type1">
    Effect one
  </button>

  <button class="button type2">
    Effect two
  </button>
  
  <button class="button type3">
    Effect three
  </button>
  
  <button class="button type4">
    Effect Four
  </button>
</div>

<p class="copyright"> By <a href="http://emanuelgsouza.dev">EmanuelG</a> </p>
              
            
!

CSS

              
                // Variables
$color: black
$body-color: #ecf0f1
$color1: #566473
$color2: #16a085
$color3: #435a6b
$color4: red

@import url('https://fonts.googleapis.com/css?family=Raleway')

// General configs
* 
  box-sizing: border-box

body
  margin: 0
  padding: 0
  width: 100%
  height: 100vh
  display: flex
  justify-content: center
  align-items: center
  flex-direction: column
  font-family: Raleway
  background-color: $body-color

.copyright
  position: absolute
  bottom: 0
  
  a
    text-decoration: none
    color: $color2
    
    &:hover
      text-decoration: underline
  
  
// Button component
.button
  position: relative
  padding: 1em 1.5em
  border: none
  background-color: transparent
  cursor: pointer
  outline: none
  font-size: 18px
  margin: 1em 0.8em
  
  &.type1
    color: $color1
    // Effect one
    &.type1::after,
    &.type1::before
      content: ''
      display: block
      position: absolute
      width: 20%
      height: 20%
      border: 2px solid
      transition: all 0.6s ease
      border-radius: 2px

    &.type1::after
      bottom: 0
      right: 0
      border-top-color: transparent
      border-left-color: transparent
      border-bottom-color: $color1
      border-right-color: $color1

    &.type1::before
      top: 0
      left: 0
      border-bottom-color: transparent
      border-right-color: transparent
      border-top-color: $color1
      border-left-color: $color1

    &.type1:hover:after,
    &.type1:hover:before
      width: 100%
      height: 100%
   
  &.type2
    color: $color2
    // Effect 2
    // Inspiration https://tympanus.net/Development/CreativeLinkEffects/
    &.type2:after,
    &.type2:before
      content: ''
      display: block
      position: absolute
      top: 100%
      left: 0
      width: 100%
      height: 2px
      background-color: $color2
      transition: all 0.3s ease
      transform: scale(0.85)

    &.type2:hover:before
      top: 0
      transform: scale(1)

    &.type2:hover:after
      transform: scale(1)
  
  &.type3
    color: $color3
    
    //Effect three
    // Effect one
    &.type3::after,
    &.type3::before
      content: ''
      display: block
      position: absolute
      width: 20%
      height: 20%
      border: 2px solid
      transition: all 0.6s ease
      border-radius: 2px

    &.type3::after
      bottom: 0
      right: 0
      border-top-color: transparent
      border-left-color: transparent
      border-bottom-color: $color3
      border-right-color: $color3

    &.type3::before
      top: 0
      left: 0
      border-bottom-color: transparent
      border-right-color: transparent
      border-top-color: $color3
      border-left-color: $color3

    &.type3:hover:after,
    &.type3:hover:before
      border-bottom-color: $color3
      border-right-color: $color3
      border-top-color: $color3
      border-left-color: $color3
      width: 100%
      height: 100%

  &.type4
    color: $color4
    
    &::after
      content: ''
      display: block
      position: absolute
      height: 2px
      width: 0
      left: 0
      background-color: red
      transition: width 0.3s ease-in-out

    &::after
      bottom: 0
    
    &:hover::after
      width: 50px
              
            
!

JS

              
                
              
            
!
999px

Console