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.

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

              
                mixin card 
 a(href="#").c-card
  h4.c-card__title Title title
  p.c-card__subtitle Subtitle or tagline
  time.c-card__datetime Monday 10 Oct
  p.c-card__tags(title="categories.") 
    span.c-tag Tag 
    span.c-tag Tag 
  span.c-card__action Call to action!
  div.c-card__image
  
h3.h-accessibility A list of shows on Monday
ol.h-list.o-grid
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card
  li.o-grid__item.h-colspan--321
    +card


              
            
!

CSS

              
                @mixin grid($cols, $gutter) {

	display: grid;
	grid-template-columns: [full-start] repeat($cols,1fr) [full-end];
	grid-gap: $gutter;

	// default to full width PLEASE RETAIN THIS OR EVERYTHING BREAKS
	> * { grid-column-end: span $cols; }
}
@mixin template($elements...) {
  @each $element in $elements {
    &__#{$element} {
      grid-area: $element;
    }
  }
}
$b: 1.25rem;

// GRID OBJECT
.o-grid {
	@include grid(12, $b);

	& .o-grid {
		width: 100%;
	}
  @media (max-width:50em) {grid-gap: $b*2 $b}

}
//---------------------------
// excerpt from my FASTER GRID HELPERS FOR COMMON PATTERNS
// 3 2 1 = thirds on desktop, halves on tablet, full on mobile - most common
//
.h-colspan--321, .h-colspan--331 {
	grid-column-end: span 4; // 3 = one third
}
// halves for tablets
@media(max-width:50em) {
	.h-colspan--321, .h-colspan--621, .h-colspan--221 {
		grid-column-end: span 6;  //  2 = half
	}
	.h-center--611 {
		grid-column: 1 / 13; //full
	}
}
//stack for mobile but allow halves
@media(max-width:37.5em) {
	.h-colspan--321, .h-colspan--331, .h-colspan--621, .h-colspan--221 {
		grid-column-end: span 12;  // 1 = full
	}
	.h-center--611 {
		grid-column: 1 / 13; //full
	}
}

//ELEMENTS OF CARD
.c-card {
  font:1.5em Futura, sans-serif;
  text-decoration:none; color: #222;
  
  &__title,&__subtitle, &__tags {margin:0}
  &__image {background: lightgrey; min-height:190px; }
  &__datetime{ align-self:center}
  &__tags {text-transform:uppercase; font-size:.75em; }
  &__action {background:#f50; color:white; padding:.5em;}
  
  &:hover, &:focus {
    outline: 2px solid lightgrey;
    .c-card__action {filter:hue-rotate(180deg)}
  }
}
//LAYOUT OF ELEMENTS
.c-card { 
  display: grid;
  grid-gap:$b/2 $b;
    //assign elements to areas, listing all possible contents of card including stuff not present
  @include template(image, title, subtitle, summary, tags, datetime, action);
  grid-template-columns: 0 1fr 1fr;
  grid-template-areas:
    "image image image"
    ". title title"
    ". subtitle subtitle"
    ". datetime action";
  
  &__tags {grid-area: image; z-index:1; justify-self:end} //overlap this
  
  @media (max-width:50em) {
    grid-template-columns: 1fr;
    grid-template-areas:
    "image"
    "title"
    "datetime"
    "action";
    &__subtitle {display:none}
  }
}

// functional stuff for this example
ol {list-style:none; margin:$b $b/2; padding:0; & li {margin:0; padding:0}}
@mixin screen($state) {
  @if $state == hide {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  }
  @else if $state == show {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: normal;
  width: auto;
  @content;
  }
}
.h-accessibility {@include screen(hide)}


              
            
!

JS

              
                
              
            
!
999px

Console