Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

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.

            
              <div class="grid">
  <div class="hero">
    <img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/bill_and_ted_excellent_adventure_logo.png' alt="Bill and Ted's Excellent Adventure" />
  </div>
  <div class="content intro">
    <h1>History is about to be re-written by two guys who can't spell</h1>
		<picture>
			<source srcset="https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/bill-ted.jpg" media="(prefers-color-scheme: dark)">
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/billandtedsexcellent_pub02-h_2019.jpg' alt=''>
		</picture>
  </div>

  <div class="start-half">
    <p>Maecenas faucibus mollis interdum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec sed odio dui. Sed posuere consectetur est at lobortis. Sed posuere consectetur est at lobortis.</p>
		<p>Donec ullamcorper nulla non metus auctor fringilla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
  </div>
  <div class="end-half">
		<p>Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec ullamcorper nulla non metus auctor fringilla. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>

<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Cras mattis consectetur purus sit amet fermentum. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
	</div>
  <div class="full-width band">
    <div>	
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/wyld-stallyns-logo-A2844943B7-seeklogo.com.png' alt=''>
			<h2>Needs You!</h2>
		</div>
  </div>
	<div class="center">
		<h3>If we were one of Europe's greatest leaders, and we were stranded in San Dimas for one day where would we go?</h3>
	</div>
  <div class="posts">
    <ul>
			<li><h4>Raging Waters Water Park?</h4>
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/hqdefault.jpg' alt=''></li>
			<li><h4>San Dimas Bowling Alley?</h4>
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/billandted_napoleanbowling.jpg' alt=''></li>
			<li><h4>San Dimas Mall?</h4>
				<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/tGYLu0ff3kOl.jpg' alt=''>
			<li><h4>Zyggie's Ice Cream Parlour?</h4>
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/napoleon-preview-600x350.jpg' alt=''></li>
    </ul>
  </div>
	<div class="full-width apply">
		<div>
			<h3>Apply to San Dimas High</h3>
			<p>Want to be as excellent as you can be? <br />Sign up to San Dimas High School because...</p>
			<h4>San Dimas High School Football Rules!</h4>
			<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/748476/hqdefault%20(1).jpg' alt=''>
		</div>
    <div>
			<h3>Fill out the form below to apply</h3>
			<p>P.S. If you flunk out, you will have to go to military school...</p>
			<form>
				<label for="first-name">First Name</label>
				<input type="text" value="" id="first-name" />
				
				<label for="last-name">Last Name</label>
				<input type="text" value="" id="last-name" />
				
				<label for="reason-select">Reason for joining:</label>
				<select name="pets" id="pet-select">
						<option value="">--Please choose an option--</option>
						<option value="football">Join the football team</option>
						<option value="band">Join Wyld Stallions</option>
						<option value="excellent">Be Excellent</option>
						<option value="dropout">Flunk out and go to military school</option>
				</select>
				<input type="submit" value="Apply Now!" />
			</form>		
		</div>
  </div>
	<div class="content notices">
		<p><strong>Disclaimer:</strong> All images and content have been shamelessly stolen from the internet for personal use only. <br />This page is purely an experiment of new CSS features and is not used commercially in anyway.</p>
		<p>Be Excellent to Each Other.</p>
	</div>
</div>
            
          
!
            
              /**
 * Global Type Stuff
 */
:root {
	--bg-color-main: #efefef;
	--bg-color-subtle: #fff;
	--color-brand: #ba141c; 
	--color-text: #000;
	--color-text-alt: #fff;
	
	@media ( prefers-color-scheme: dark ) {
		--bg-color-main: #000;
		--bg-color-subtle: #1a1a1a;
		--color-brand: #FDD835; 
		--color-text: #fff;
		--color-text-alt: #000;
	}
}

$grid-columns: 4; // This would be nice if it's dynamic?

body {
  margin: 0 ;
  padding: 0;
  font: 125% "Open sans", sans-serif;
}

/**
 * Grid Specific Stuff
 */
.grid {
  display: grid;
  gap: 1em;
  grid-template-columns:
    [full-start] minmax(0,1fr)
    [content-start first-half-start quarter-1-start] minmax(0,1fr)
    [center-start quarter-1-end quarter-2-start] minmax(0,1fr)
    [first-half-end second-half-start quarter-2-end quarter-3-start] minmax(0,1fr)
    [center-end quarter-3-end quarter-4-start] minmax(0,1fr)
    [second-half-end quarter-4-end content-end] minmax(0,1fr)
    [full-end];
}

.hero, 
.full-width {
	grid-column: full;
}

.full-width {
	display: grid;
	row-gap: 1em;
  grid-template-columns: minmax(10px, 1fr) 2fr 2fr minmax(10px, 1fr); 
	grid-gap: 2em;
}

.band > div {
	grid-column: 2 / 4;
}

.content {
  grid-column: content;
}

.center {
	grid-column: center;
}

.start-half {
	grid-column: first-half;
}

.end-half {
	grid-column: second-half;
}

.posts {
	grid-column: content;
	display: grid;
	row-gap: 1em;
  grid-template-columns: subgrid;
}

.posts ul {
	list-style-type: none;
  margin: 0;
  padding: 0;
  grid-column: content;
  display: grid;
  row-gap: 1em;
  grid-template-columns: repeat(4, 1fr);
}

.apply div:first-child {
	grid-column: 2 / 3;
}

.apply div:last-child {
	grid-column: 3 / 4;
}

/**
 * Presentational Stuff
 */
body {
	background-color: var( --bg-color-subtle );
	color: var( --color-text );
}

.hero {
	background-color: var( --bg-color-main );
	display: flex;
	justify-content: center;
	padding: 4em;
}

.hero > img {
	max-width: 30em;
	@media ( prefers-color-scheme: dark ) {
		filter: 
			hue-rotate(60deg)
			brightness(3)
			saturate(1.4);
	}
}

.intro {
	margin-bottom: 1em;
}

.intro h1 {
	margin-bottom: 1.25em;
}

.intro picture {
	display: flex;
	flex-direction: column;
}

.intro picture > img {
	align-self: center; // Stops image stretching by resetting the default from align-self: stretch.
}

.start-half,
.end-half {
	margin-bottom: 1em;
}

.full-width {
	background-color: var( --bg-color-main );
	padding: 1em;
}

.band > div {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 2em 0 0.5em 0;
}

.band > div img {
	align-self: center;
	
	@media ( prefers-color-scheme: light ) {
	  filter:
  	brightness(1.2)
  	contrast(1.2);
	}
}

.content > h1,
.center > h3 {
	text-align: center;
}

.center {
	padding-top: 1em;
}
.posts {
	padding: 1em 0;
	margin-bottom: 2em;
}

.posts li {
	background-color: var( --bg-color-main );
	padding: 0 1em 1em 1em;
}

.posts img {
	max-width: 100%;
	
	@media ( prefers-color-scheme: dark ) {
	  filter:
  	brightness(.8)
  	contrast(1.2);
	}
}

.apply {
	padding: 2em 0 3.5em 0;
}

.apply img {
	max-width: 100%;
}

.apply p,
.apply label {
	font-size: 1rem;
}

.apply div:last-child p {
	font-style: italic;
}

.apply form {
	width: 100%;
	display: flex;
	flex-direction: column;
}

.apply input {
	font-size: 1rem;
	margin-bottom: 2em;
	padding: 0.5em;
	background-color: var( --bg-color-main );
	border: solid 1px var( --color-text );
	color: var( --color-text );
}

.apply select {
	margin-bottom: 4em;
	background-color: var( --bg-color-main );
	border: solid 1px var( --color-text );
	color: var( --color-text );
	padding: 0.75em 0.5em;
}

.apply input[type="submit"] {
	align-self: flex-start;
	background-color: var( --color-brand );
	border: solid 1px var( --color-brand );
	color: var( --color-text-alt );
	font-size: 1.5rem;
	padding: 0.75em 2em;
}

.notices {
	padding: 0.5em 0 1.5em 0;
	text-align: center;
}

.notices > p {
	font-size: 1rem;
}

.notices > p:first-child {
	font-style: italic;
}
            
          
!
            
              /**
 * This demo only works in Firefox Nightly for now 
 * because it also includes some sub GRID experiments.
 *
 * Demo for @media ( prefers-color-scheme: dark )
 * Applied to:
 * - Theme colours using custom properties.
 * - Filter applied to logo to change color.
 * - srcset on main image to change images.
 * - Filter applied to Wyld Stallions logo to increase brightness and contrast.
 * - Filter applied to post thumbnails to reduce brightness and increase contrast.
 *
 * Browser support:
 * - Filter not supported in IE, Edge 12 or Safari 5.1
 * - prefers-color-scheme not supported in IE, Edge or Opera
 * https://caniuse.com/#search=prefers-color-scheme
 *
 * Additional code to create this:
 * - 20 lines of CSS
 * - media query in <source>
 */
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console