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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div id="goals">
	<h1>Goal:</h1>
	<p>Pure CSS Hide/Show System</p>
	<p>Decide which system is most optimal and requires the least or no direct styles based on IDs</p>
	<h2>What has been achieved:</h2>
	<p>Both function as a hide show</p>
	<p>Target example can now display the first input data without being clicked, and hide when other input data is clicked</p>
	<h3>What we still want:</h3>
	<p>Achieve displaying the first input data in the target example without needing to flip the order of the data in the HTML</p>
	<p>Ability to style the buttons based on which input data is visible</p>
	<p>Button hove style effects</p>
	<p>Any other ideas?</p>
</div>
<div id="checked-example">
	<h1>Checked Example</h1>
	<input id="input1" name="inputs" class="hidden" type="radio" checked="checked" />
	<input id="input2" name="inputs" class="hidden" type="radio" />
	<input id="input3" name="inputs" class="hidden" type="radio" />
	<input id="input4" name="inputs" class="hidden" type="radio" />
	<div id="button-container">
		<label for="input1" class="button">Input 1</label>
		<label for="input2" class="button">Input 2</label>
		<label for="input3" class="button">Input 3</label>
		<label for="input4" class="button">Input 4</label>
	</div>
	<div id="content-container">
		<div id="input1-data" class="data">Input 1 Data</div>
		<div id="input2-data" class="data">Input 2 Data</div>
		<div id="input3-data" class="data">Input 3 Data</div>
		<div id="input4-data" class="data">Input 4 Data</div>
	</div>
</div>
<div id="target-example">
	<h1>Target Example</h1>
	<div id="target4-data" class="data">Target 4 Data</div>
	<a href="#target4-data" class="button">Anchor 4</a>
	<div id="target3-data" class="data">Target 3 Data</div>
	<a href="#target3-data" class="button">Anchor 3</a>
	<div id="target2-data" class="data">Target 2 Data</div>
	<a href="#target2-data" class="button">Anchor 2</a>
	<div id="target1-data" class="data">Target 1 Data</div>
	<a href="#target1-data" class="button">Anchor 1</a>
</div>
            
          
!

CSS

            
              .hidden {
	position: absolute;
	top: 0; left: 0;
	visibility: hidden;
}

.button {
	margin: 1rem;
	padding: 0.5rem;
	background-color: pink;
	color: green;
	display: inline-block;
	text-decoration: none;
}

.data {
	width: 5.5rem;
	height: 5.5rem;
	margin: 1rem;
	padding: 2.5rem;
	background-color: green;
	color: pink;
	display: none;
}

#input1:checked ~ div #input1-data,
#input2:checked ~ div #input2-data,
#input3:checked ~ div #input3-data,
#input4:checked ~ div #input4-data {
	display: block;
}

#target-example {
	display: flex;
	flex-flow: row wrap;
}
#target-example > h1 {
	flex-basis: 100%;
}
#target-example > a {
	order: 1;
	max-height: min-content;
}
#target-example > div {
	order: 2;
}

div:target {
	display: block;
}

#target-example > div:last-of-type:not(:target) {
	display: block;
}

#target-example > div:target ~ div:last-of-type {
	display: none;
}

#checked-example,#target-example {
	margin: 0 2rem 0;
	float: left;
}
            
          
!

JS

            
              
            
          
!
999px

Console