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

              
                <div style="width:360px; margin:50px auto">
  <a href="https://harrowarts.com/whats-on/event/summer-music-camp-2019" class="c-card
     c-card--event       c-card--brand-music">
  <div class="c-card__image">
    <div class="o-image" style="padding-top: 59.7765%;"><img itemprop="image" src="https://d2r25twc4vcpx5.cloudfront.net/_imager/files/2341/Summer-Music-Camp_a1c94a7efcd995df46820e904cc817b4.jpg" alt="A picture of four children all in red t-shirts having fun at the Summer Music Camp event." class="o-image__full  isLoaded">
      <div
        class="o-image__preview" style="background-image: url(&quot;data:image/gif;base64,R0lGODlhAwADALMAAKw6NMS6tLReVMRORNzW1KRGPMy6vLxqZMROTP///wAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAkALAAAAAADAAMAAAQHkARzxChgRAA7&quot;);"></div>
  </div>
  </div>
  <h3 class="c-card__title h-text--h5">Summer Music Camp</h3>
    <p class="c-card__badge o-badge h-text--badge">HAC Highlight </p>
  <h4 class="c-card__datetime"><time datetime="2019-07-25T10:30:00+01:00" itemprop="startDate">Thu 25</time> – <time datetime="2019-07-31T18:00:00+01:00" itemprop="endDate">Wed 31 Jul</time></h4>
  <p class="c-card__tags h-text--label"><span class="h-accessibility">Categories: </span><span class="c-card__tag c-tag">Music /&nbsp;</span><span class="c-card__tag c-tag">Family</span> </p>
    <span class="c-card__action o-button">
      Info / Book
    </span></a>
</div>

              
            
!

CSS

              
                /**
 * Name         : Card
 * Description  : Cards are the main media object. Lay these out ASAP.
 * State        : green
 */

.c-card {
   //list all possible  elements  of card
  @include grid-template(image, title, badge, tags, summary, datetime, action);
   
  // layout  
  display: grid;
  grid-gap: $b/2;
  height: 100%; //stretch to row height because our cards don't know they are in a parent grid
  grid-template-rows: min-content min-content 1fr 1fr;
  grid-template-columns: 1fr min-content;
  grid-template-areas:
      "image     image"
      "title     title"
      "datetime  datetime"
      "tags      action";
  
  
  // styles per element
  &__image { overflow: hidden }
  &__title {
    transition: color 0.4s;

    @include on-event(false, ".c-card") {
      color: color(brand, _500);
      text-decoration: underline;
    }
  }
  &__datetime { @include text--page-date }
  &__tags { margin: auto auto 0 0 }
  &__badge { grid-area: image;}
  &__action {
    margin: auto 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    
    @include on-event(false, ".c-card") {
      background: color(black, _500);
      color: color(white, _500);
      border-color: color(black, _500);
    }
  }
}

/**
 * Variants
 * Types of cards: here only event and class
 *
 */

// 1. event
.c-card {
  &--event, &--class {
    padding-bottom: $b/2;
    border-bottom: 5px solid;
  }
  // 2. classes is same as event but the colors are only class colour (green)
  &--class {
    border-color: color(brand-classes, _500);
  }
}

// colours like panels
@each $color, $color-map in $colors {
  .c-card--#{$color} {
    // color : color(white, _500);
    border-color: map-get($color-map, _500) !important;
  }
}


              
            
!

JS

              
                
              
            
!
999px

Console