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

Auto Save

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

              
                <main>

	<h1>Pure CSS Accordion</h1>
	<div class="accordion">
		<input type="radio" name="accordion" id="accordion-1" checked="">
		<label for="accordion-1">Accordion One</label>
		<div class="accordion-content">
			<p><b>Accordion Content - 1</b></p>
			<p>Made using pseudo selector radio inputs:checked + labels for tabs, and + selector to target adjacent siblings accordion content.</p>
			<p>*Remove checked="" on the first accordion if you want to start with a fully closed accordion.</p>
			<p>Super simple, and easy to modify for your own needs.</p>
		</div>

		<input type="radio" name="accordion" id="accordion-2">
		<label for="accordion-2">Accordion Two</label>
		<div class="accordion-content">
			<p><b>Accordion Content - 2</b></p>
			<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.<br/>Fugit deserunt aliquam quia dicta qui natus error aut molestiae nostrum nihil possimus iure, veniam architecto aspernatur id nulla, incidunt ducimus suscipit.</p>
			<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit deserunt aliquam quia dicta qui natus error aut molestiae nostrum </p>
		</div>

		<input type="radio" name="accordion" id="accordion-3">
		<label for="accordion-3">Accordion Three</label>
		<div class="accordion-content">
			<p><b>Accordion Content - 3</b></p>
			<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit deserunt aliquam quia dicta qui natus error aut molestiae nostrum nihil possimus iure, veniam architecto.</p>
			<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit deserunt aliquam quia dicta qui natus error aut molestiae nostrum nihil possimus iure, veniam architecto.Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
		</div>

	</div>
</main>
    <footer>
        <p>Developed by Stephen Fray 🏄 | <a href="https://codepen.io/stepfray" target="_blank" rel="noreferrer" title="View My Code Pen Profile">CodePen</a> | <a href="https://www.behance.net/stephen_fray" arget="_blank" rel="noreferrer" title="View my Behance Profile">Behance</a></p>
    </footer>

              
            
!

CSS

              
                ////////////////////
// Colour Vars
////////////////////
$light: #eee;
$light-shade-2: #ccc;
$light-shade-3: #bababa;
$dark: #444444;

////////////////////
// Accordion
////////////////////
.accordion {
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
}

////////////////////
// Accordion -- Hide Radios Inputs
////////////////////
.accordion input[type="radio"] {
	display: none;
}

////////////////////
// Accordion -- Section Titles (labels)
////////////////////
.accordion label {
	padding: 0.3em 1em;
	cursor: pointer;
	display: inline-flex;
	&:not(:last-of-type) {
		border-bottom: 1px solid $light-shade-3;
	}
	&:first-of-type {
		border-top-left-radius: 10px;
		border-top-right-radius: 10px;
	}
	&:last-of-type {
		border-bottom-left-radius: 10px;
		border-bottom-right-radius: 10px;
	}
}
.accordion label {
	user-select: none;
	background-color: $light-shade-2;
}
.accordion label:hover {
	background: $light-shade-2;
}
.accordion input:checked + label {
	background: $light-shade-2;
	border-bottom: 1px solid $light;
	&:last-of-type {
		border-bottom-left-radius: 0;
		border-bottom-right-radius: 0;
	}
}

////////////////////
// Accordion -- Content
////////////////////
.accordion-content {
	background-color: $light;
	overflow: hidden;
	&:last-of-type {
		border-bottom-left-radius: 10px;
		border-bottom-right-radius: 10px;
	}
	p {
		margin-bottom: 0;
		&:first-of-type {
			margin-top: 0;
		}
	}
}

////////////////////
// Accordion -- Show/Hide Content
////////////////////
.accordion-content {
	max-height: 0;
	visibility: hidden;
	transition: all 0.8s;
	padding: 0 1.2em;
	* {
		opacity: 0;
		transition: opacity 0.8s;
	}
}
.accordion input[type="radio"]:checked + label + .accordion-content {
	max-height: 100vh;
	visibility: visible;
	opacity: 1;
	padding: 1.2em;
	* {
		opacity: 1;
	}
}

////////////////////
// Page Set Up - Ignore
////////////////////
* {
	box-sizing: border-box;
}
body {
	color: $dark;
	display: grid;
	place-content: center;
	padding: 0;
	margin: 0;
	min-height: 100vh;
	background-image: #99c5ff;
	background-image: radial-gradient(
			at 32% 10%,
			hsla(29, 95%, 71%, 1) 0,
			transparent 52%
		),
		radial-gradient(at 46% 54%, hsla(179, 98%, 69%, 1) 0, transparent 47%),
		radial-gradient(at 33% 9%, hsla(199, 73%, 71%, 1) 0, transparent 53%),
		radial-gradient(at 63% 58%, hsla(200, 77%, 77%, 1) 0, transparent 52%),
		radial-gradient(at 60% 91%, hsla(45, 70%, 78%, 1) 0, transparent 56%),
		radial-gradient(at 14% 87%, hsla(297, 77%, 69%, 1) 0, transparent 51%),
		radial-gradient(at 81% 56%, hsla(309, 85%, 62%, 1) 0, transparent 40%),
		radial-gradient(at 70% 57%, hsla(261, 98%, 77%, 1) 0, transparent 40%),
		radial-gradient(at 37% 48%, hsla(260, 85%, 60%, 1) 0, transparent 54%),
		radial-gradient(at 54% 28%, hsla(230, 77%, 69%, 1) 0, transparent 56%),
		radial-gradient(at 22% 83%, hsla(54, 91%, 76%, 1) 0, transparent 58%),
		radial-gradient(at 58% 34%, hsla(170, 96%, 62%, 1) 0, transparent 58%),
		radial-gradient(at 43% 93%, hsla(59, 92%, 79%, 1) 0, transparent 42%),
		radial-gradient(at 3% 23%, hsla(125, 72%, 78%, 1) 0, transparent 41%),
		radial-gradient(at 77% 92%, hsla(24, 82%, 64%, 1) 0, transparent 58%),
		radial-gradient(at 62% 97%, hsla(53, 87%, 72%, 1) 0, transparent 54%),
		radial-gradient(at 84% 48%, hsla(133, 81%, 78%, 1) 0, transparent 42%);
	/// Background by Mesher
	/// Spread the love: https://www.csshero.org/mesher/
	font-family: apple-system, sans-serif;
	font-size: 18px;
	line-height: 1.5;
	padding-bottom: 50vh;
}
main {
	max-width: 700px;
	margin: auto;
	padding: clamp(15px, 2vw, 60px);
}
h1 {
	font-size: clamp(1.5rem, 7vw, 2.5rem);
}
p {
	font-size: clamp(0.9rem, 3vw, 1.1rem);
}
label {
	font-size: clamp(1rem, 3vw, 1.4rem);
}
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 10px;
	z-index:9999999;
    p {
        font-size: 0.8rem;
        margin: 0;
    }
}
              
            
!

JS

              
                


              
            
!
999px

Console