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

              
                <h1>Pure CSS navigation buttons</h1>
<p>Just focus them ! (warning, some browsers don't focus on buttons, use JavaScript or another way to toggle on a real project)</p>

<div class="wrapper">

<section>
  <h2>.cross-button</h2>
  <button class="nav-button cross-button" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>

<section>
  <h2>.arrow-button-1</h2>
  <button class="nav-button arrow-button-1" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>

<section>
  <h2>.arrow-button-2</h2>
  <button class="nav-button arrow-button-2" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>
  
<section>
  <h2>.arrow-button-3</h2>
  <button class="nav-button arrow-button-3" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>

<section>
  <h2>.arrow-button-4</h2>
  <button class="nav-button arrow-button-4" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>

<section>
  <h2>.round.button</h2>
  <button class="round-button" type="button" id="toggle-button" aria-label="open/close navigation"></button>
</section>
  
 </div>

<p>More fantastic stuffs on <a href="https://sarasoueidan.com/demos/navicon-transformicons/">https://sarasoueidan.com/demos/navicon-transformicons/</a></p>
              
            
!

CSS

              
                /* Common button styles */
.nav-button {
  position: relative;
  height: 2.4rem;
  width: 2.8rem;
  background-color: transparent;
  background-image: linear-gradient(to right, currentColor, currentColor);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 5px;
  padding: 0;
  outline: 0;
  border: 0;
  color: #333;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: .25s cubic-bezier(.17,.67,.89,1.4);
  transition-property: transform;
  will-change: transform;
 }
.nav-button::before,
.nav-button::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  display: block;
  height: 5px;
  background: currentColor;
  transition: .25s;
  transition-property: transform, top;
  will-change: transform, top;
}
.nav-button::before {
  top: 0;
}
.nav-button::after {
  top: calc(100% - 4px);
}



/* cross button */
.cross-button:focus {
  background-image: none;
}
.cross-button:focus::before,
.cross-button:focus::after{
   top: 50%;
 }
.cross-button:focus::before {
   transform: translate3d(0,-50%,0) rotate3d(0,0,1,45deg);
 }
.cross-button:focus::after {
   transform: translate3d(0,-50%,0) rotate3d(0,0,1,-45deg);
 }



/* arrow button 1 */
.arrow-button-1:focus {
   transform: rotate(90deg) translateZ(0);
 }
.arrow-button-1:focus::before {
  width: 60%;
  transform: rotate(-45deg) translate3d(-48%, 0, 0);
 }
.arrow-button-1:focus::after {
  width: 60%;
  transform: rotate(45deg) translate3d(-48%, 0, 0);
 }


/* arrow button 2 */
.arrow-button-2:focus {
  transform: rotate(180deg);
 }
.arrow-button-2:focus::before {
  width: 60%;
  transform: rotate(-45deg) translate3d(-48%, 0, 0);
 }
.arrow-button-2:focus::after {
  width: 60%;
  transform: rotate(45deg) translate3d(-48%, 0, 0);
 }

/* arrow button 3 */
.arrow-button-3:focus {
   transform: rotate(-90deg) translateZ(0);
 }
.arrow-button-3:focus::before {
  width: 60%;
  transform: rotate(-45deg) translate3d(-48%, 0, 0);
 }
.arrow-button-3:focus::after {
  width: 60%;
  transform: rotate(45deg) translate3d(-48%, 0, 0);
 }

/* arrow button 4 */
.arrow-button-4:focus::before {
  width: 60%;
  transform: rotate(-45deg) translate3d(-48%, 0, 0);
 }
.arrow-button-4:focus::after {
  width: 60%;
  transform: rotate(45deg) translate3d(-48%, 0, 0);
 }

/* Round button */
.round-button {
  display: inline-block;
  position: relative;
  z-index: 1;
  height: 4rem;
  width: 4rem;
  background-color: transparent;
  padding: 0;
  outline: 0;
  border: 1px solid #333;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  transition: transform .2s;
}
.round-button::after,
.round-button::before {
  content: "";
  position: absolute;
  top: 15%;
  right: 40%;
  bottom: 15%;
  left: 40%;
  background-color: #333;
  border-radius: 10px;
  transition: transform .25s;
  will-change: transform;
}
.round-button::before {
  top: 40%;
  right: 15%;
  bottom: 40%;
  left: 15%;
}
/* opened nav button */
.round-button:focus,
.round-button:focus::before {
  transform: rotate(90deg) translateZ(0);
}




/* Global deco */

html {
  font-size: 62.5%;
}

body {
  margin: 0;
  padding: 2rem;
  background: #222;
  color: #fff;
  font-family: helvetica, arial, sans-serif;
  font-size: 1.4em;
  line-height: 1.5;
}
.wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
section {
  display: inline-block;
  border: .5rem solid #000;
  vertical-align: top;
  margin-bottom: .5rem;;
  padding: 1rem 2rem 4rem;
  text-align: center;
  background: #efefef;
  flex: 1 0 25%;
}

h1,
h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  
}

h1 {
  font-size: 2.8rem;
  color: #bbb;
}

h2 {
  margin-top: 2rem;
  color: #333;
}

a {
  color: #bbb
}

              
            
!

JS

              
                
              
            
!
999px

Console