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="wrapper">    
  <a class="menu-1" data-menu="1"></a>
  <a class="menu-2" data-menu="2"></a>
  <a class="menu-3" data-menu="3"></a>
  <a class="menu-4" data-menu="4"></a>
</div>
              
            
!

CSS

              
                html, body
  background-color: #212121
.wrapper
  width: 600px
  margin: 50px auto
.menu-1, .menu-2,
.menu-3, .menu-4
  position: relative
  display: inline-block
  width: 40px
  height: 40px
  margin: 50px
  cursor: pointer
  transition: all .3s
  &:before, &:after
    content: ''
    position: absolute
    transition: all .3s
.menu-4
  top: -10px
  width: 30px
  height: 30px
  border-bottom: 4px solid #e3e3e3
  &:hover
    border-bottom-color: hotpink
  &:hover:before, &:hover:after
    background-color: hotpink
  &:before, &:after
    background-color: #e3e3e3
    height: 4px
    width: 30px
    top: 50%
    left: 50%
    margin-left: -15px
  &:before
    margin-top: -10px
  &:after
    margin-top: 3px
.menu-4-active
  top: 0
  margin-left: 38px
  height: 50px
  width: 50px
  border: 0
  background-color: red
  &:before, &:after
    background-color: #e3e3e3 !important
    margin-left: -15px !important
    margin-top: -2px !important
  &:before
    transform: rotate(45deg) !important
  &:after
    transform: rotate(-45deg) !important
.menu-3
  background-color: #e3e3e3
  width: 50px
  height: 50px
  &:hover
    background-color: orange
  &:before, &:after
    background-color: #212121
    height: 4px
    width: 30px
    top: 50%
    left: 50%
    margin-left: -15px
  &:before
    margin-top: -6px
  &:after
    margin-top: 4px
.menu-3-active
  border-radius: 40px
  background-color: red !important
  &:before, &:after
    background-color: #e3e3e3
    margin-left: -15px !important
    margin-top: -2px !important
  &:before
    transform: rotate(45deg) !important
  &:after
    transform: rotate(-45deg) !important
.menu-2
  border: 4px solid #e3e3e3
  &:hover
    border-color: aqua
  &:before, &:after
    background-color: #e3e3e3
    height: 4px
    width: 30px
    top: 50%
    left: 50%
    margin-left: -15px
  &:before
    margin-top: -6px
  &:after
    margin-top: 4px
.menu-2-active
  transform: rotate(45deg)
  border-color: red !important
  background-color: red !important
  &:before, &:after
    margin-left: -15px !important
    margin-top: -2px !important
  &:after
    transform: rotate(-90deg) !important
.menu-1
  border: 4px solid #e3e3e3
  border-radius: 50px
  &:hover
    border-color: limegreen
    background-color: limegreen
  &:before, &:after
    width: 60px
    height: 4px
    background-color: #e3e3e3
    left: 50%
    margin-left: -30px
  &:before
    top: 50%
    margin-top: -8px
  &:after
    top: 50%
    margin-top: 4px
.menu-1-active
  background-color: red !important
  border-color: red !important
  &:before, &:after
    margin-top: -2px
  &:before
    transform: rotate(45deg)
  &:after
    transform: rotate(-45deg)
 
    
              
            
!

JS

              
                var menu = $('.wrapper a');

menu.on('click', function() {
  var menuNum = $(this).data('menu');
  $(this).toggleClass('menu-'+ menuNum +'-active');
})
              
            
!
999px

Console