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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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 role="radiogroup" class="tabs" aria-labelledby="radiogroup_title" id="radiogroup"> <!-- tabs open -->

<p id="radiogroup_title">Biography</p>
	
  <input type="radio" name="tabs" id="about_me" checked="checked" role="radio" aria-checked="true" tabindex="0">
  <label for="about_me">About me<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>About me</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  </div>
  
  <input type="radio" name="tabs" id="skills_software" role="radio" aria-checked="false" tabindex="0">
  <label for="skills_software">Skills & software<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Skills & software</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  </div>
  
  <input type="radio" name="tabs" id="experience" role="radio" aria-checked="false" tabindex="0">
  <label for="experience">Experience<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Experience</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  </div>
	
  <input type="radio" name="tabs" id="accolades" role="radio" aria-checked="false" tabindex="0">
  <label for="accolades">Accolades<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Accolades</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  </div>
	
	  <input type="radio" name="tabs" id="tab_five" role="radio" aria-checked="false" tabindex="0">
  <label for="tab_five">Tab five<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Tab five content</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  </div>
	
	  <input type="radio" name="tabs" id="tab_six" role="radio" aria-checked="false" tabindex="0">
  <label for="tab_six">Tab six<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Tab six content</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  </div>	

	  <input type="radio" name="tabs" id="overflow_tab" role="radio" aria-checked="false" tabindex="0">
  <label for="overflow_tab">Overflow tab<div class="plus_minus_toggle"></div></label>
  <div class="tab">
    <h1>Overflow tab content</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  </div>	
		
	
</div><!-- tabs close -->
<h1>Testing to see if this content moves up and down based on the content in the open tab 😎</h1>

<!-- No overflow scroll of tab group at top sadly, will simply wrap onto another row, but is sticky now -->
              
            
!

CSS

              
                /* Generic Styling */
body {
  background: #eee;
  min-height: 100vh;
	box-sizing: border-box;
	padding-top: 10vh;
  font-family: sans-serif; 
  line-height: 1.5;
  max-width: 50rem;
  margin: 0 auto;
	padding: 5vw;
}

h1 {
	line-height: 1.25;
	margin-top: 0;
}

/* Tabs */
.tabs {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap; // make sure it wraps
	align-items: flex-start;
	margin: 0 0 2rem 0;
}

#radiogroup_title {
	width: 0;
	height: 0;
	font-size: 1px;
	line-height: 0;
	text-indent: -9999px;
	padding: 0;
	margin: 0;
	position: absolute;
}

.tabs label {
	order: 1; // Put the labels first
	display: block;
	padding: 1rem 2rem 1rem 0.0625rem;
	margin: 0;
	cursor: pointer;
  font-weight: 400;
  transition: all ease 200ms;
	/*position: relative;*/
	overflow: hidden;
	position: sticky;
	top: 0; /* Required for the sticky */
	background: #eee;
	z-index: 20;
	border-bottom: 1px solid #ccc;
	/*box-shadow:  2px 8px 4px 0px rgba(0, 0, 0, 0.05);*/
}

.tabs label:nth-of-type(7) {
	top: 57px; /* Required for the sticky */
}

.tabs label::after {
  content: '';
  display: block;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  position: absolute;
  background-color: #00f;
  transition: transform ease 200ms, opacity ease 0ms 200ms;
  transform: translateX(100%);
  opacity: 0;
}

.tabs .tab {
  order: 99; // Put the tabs last
  flex: 1 0 100%;
	min-width: 100%;
	max-width: 100%;
	width: 100%;
	border-bottom: 1px solid #ccc;
	display: block;
	opacity: 0;
	height: 0;
	transform: translate(0px, 20px);
	visibility: hidden;
	padding: 0;
	/*margin: 0 0 2rem 0;
	display: none;*/
}
.tabs input[type="radio"] {
	opacity: 0;
  width: 0;
	height: 0;
	position: absolute;
}
.tabs input[type="radio"]:checked + label {
	text-decoration: none;
	color: #00f;
}
.tabs input[type="radio"]:hover + label {
	text-decoration: none;
}
.tabs input[type="radio"]:focus + label {
	outline: 2px solid orange;
	outline-offset: -2px;
	border-radius: 2px;
}
.tabs input[type="radio"]:checked + label + .tab {
	/*display: block;*/
	padding: 2rem 0;
	opacity: 1;
	height: auto;
	transform: translate(0px, 0px);
	visibility: visible;
	transition: height ease 400ms 0ms, opacity ease 400ms 0ms, transform ease 400ms 0ms;
}

.tabs .plus_minus_toggle {
	display: none;
}

label:hover ~ label::after {
  transform: translateX(-100%);
}

.tabs:not(:hover) label:not(:checked)::after {
  transform: translateY(100%);
}

.tabs:hover label:hover::after {
  transition-delay: 0ms, 0ms;
}

.tabs input[type="radio"]:checked + label::after,
label:hover::after {
  transform: translateX(0%);
  opacity: 1;
}



@media (max-width: 45em) {
  .tabs .tab,
  .tabs label {
    order: initial;
		margin: 0;
  }
  .tabs label {
    width: 100%;
		border-width: 1px 0 1px 0;
		border-style: solid;
		border-color: #ccc;
		margin: -1px 0 0 0;
		align-content: center;
    align-items: center;
    display: flex;
    justify-content: space-between;
	  padding: 1rem 0;
  }
	.tabs label::after {
		display: none;
	}
	.tabs .plus_minus_toggle {
    height: 1.25rem;
    position: relative;
    width: 1.25rem;
		display: block;
		transition: transform .4s cubic-bezier(.285,.105,.465,1.015);
	}
	.plus_minus_toggle::before {
		background: #00f;
			content: "";
			height: 0.25rem;
			left: 0;
			position: absolute;
			top: 50%;
			transform-origin: center;
			transition: transform .4s cubic-bezier(.285,.105,.465,1.015);
			width: 1.25rem;
	}
	.plus_minus_toggle::after {
			background: #00f;
			content: "";
			height: 0.25rem;
			left: 0;
			position: absolute;
			top: 50%;
			transform-origin: center;
			transition: transform .4s cubic-bezier(.285,.105,.465,1.015);
			width: 1.25rem;
			transform: rotate(90deg);
	}
	.tabs input[type="radio"]:checked + label .plus_minus_toggle {
		transform: rotate(135deg);
	}
}
              
            
!

JS

              
                /**
Forked from @ https://codepen.io/Drezu/details/ObyPMR

 * Responsive pure CSS tabs & accordion
 * Without position absolute & with a selected state
 */

/**

A lot of CSS tabs need either the tab content or labels to be position absoluted, or sacrifice the selected state on the tabs.

This uses flexbox and order to have both.

It also allows you to drop down to an accordion when on mobile.
*/
              
            
!
999px

Console