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 class="c-card">
  <div class="c-card__header">
    <img class="c-card__media" src="http://via.placeholder.com/400x200" />
  </div>
  <div class="c-card__body">
    <h2 class="c-card__title">Card Title</h2>
    <p class="c-card__description">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
  </div>
  <div class="c-card__footer">
    <a href="#" class="c-btn c-card__cta">Call to action</a>
  </div>
</div>











<select class="theme-switcher">
    <option value="default">Select A Theme</option>
    <option value="theme-1">Theme 1</option>
    <option value="theme-2">Theme 2</option>
    <option value="theme-3">Theme 3</option>
    <option value="theme-4">Theme 4</option>
    <option value="theme-5">Theme 5</option>
</select>
              
            
!

CSS

              
                







/*------------------------------------*\
    #CARD
\*------------------------------------*/

/**
 * Default variables 
 * 1) These can be seen as the "vanilla" button styles for the design   
 *    system. These define the necessary variables for each component,
 *    and applies a basic, "boring" aesthetic to it. 
 */
:root {
	--card-background-color: #fff;
	--card-text-color: #000;
  --card-font-family: Helvetica, sans-serif;
	--card-font-size: 1rem;
	--card-font-weight: 400;
	--card-border-width: 1px;
	--card-border-style: solid;
	--card-border-color: #808080;
	--card-border-radius: 0;
	--card-padding: 1rem;
  --card-box-shadow: none;
	--card-text-transform: normal;
	--card-letter-spacing: initial;
	--card-icon-width: 1rem;
	--card-icon-height: 1rem;
	--card-icon-color: currentColor;
  --card-transition: all 0.1 ease-out;
  
  --card-media-border-radius: 0;
  
  --card-header-margin-bottom: 1rem;
  
  --card-body-text-align: left;
  
  --card-title-font-size: 1.6rem;
  
  --card-description-font-family: inherit;
  
  --card-footer-justify-content: center;
}

/**
 * Theme 1 button styles
 * 1) Here we map the theme's second-tier global variables to the
 *    specific components.
 */
.theme-1 {
	--card-border-color: #eee;
  --card-border-radius: 16px;
  --card-text-color: var(--theme-1-text);
	--card-font-family: var(--theme-1-font-family-primary);
  --card-padding: 0rem;
	--card-letter-spacing: 1px;
  --card-padding: 0;
  --card-box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  
  --card-body-padding: 0 1rem 1rem;
  --card-body-text-align: center;
  
  --card-title-text-color: var(--theme-1-color-primary);
  --card-title-margin: 0 0 0;
  
  --card-description-font-family: Helvetica;
}

/**
 * Theme 2
 */
.theme-2 {
	--card-text-color: #a2a2a2;
	--card-hover-text-color: #fff;
	--card-border-color: #e5e5e5;
  --card-font-family: 'Merriweather', serif;
	--card-font-size: 13px;
	--card-text-transform: capitalize;
	--card-padding: 1rem;
  --card-box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  
  --card-header-margin-bottom: 0;
  
  --card-title-background-color: #317c2f;
  --card-title-text-color: #fff;
  --card-title-font-size: 18px;
  --card-title-padding: 0.3rem;
  --card-title-margin: 0 0 1rem;
}

/**
 * Theme 3
 */
.theme-3 {
	
	--card-font-family: 'Crete Round', serif;
	--card-font-size: 14px;
	--card-font-weight: 300;
	--card-letter-spacing: 2px;
  --card-border-width: 2;
  --card-border-color: #0892D0;
  --card-border-radius: 30px 0 30px 0;
  --card-box-shadow: 6px 6px 0 yellow;
	--card-padding: 1.5rem;
	--card-text-transform: normal;
  --card-description-font-family: Helvetica;
  --card-body-text-align: center;
}

/**
 * Theme 4
 */
.theme-4 {
	--card-border-color: #999;
	--card-font-family: 'Saira Condensed', sans-serif;
	--card-font-size: 11px;
	--card-font-weight: 500;
	--card-padding: 20px;
	--card-text-color: #333;
  --card-box-shadow: 8px 8px 0 #a60505;
	--card-text-transform: uppercase;
	--card-letter-spacing: 1.65px;
  --card-title-text-color: #a60505;
}

/**
 * Theme 5
 */
.theme-5 {
	--card-background-color: #fff;
	--card-font-family: 'Amatic SC', cursive;
	--card-text-color: blue;
	--card-hover-text-color: #252525;
	--card-text-transform: uppercase;
  --card-padding: 0;
  --card-border-width: 0;
	--card-letter-spacing: 0.8px;
	
  --card-body-padding: 1rem 1rem 4rem;
  --card-body-background: radial-gradient(ellipse at center, rgba(230,244,250,1) 0%, rgba(188,224,238,1) 100%);;
  
  --card-footer-justify-content: left;
  
  /* Additional, non-tokenied styles can be found below */
	
}

/**
 * Card
 * 1) These are the actual CSS properties for the card component.
 *    The shared CSS declarations as written as normal CSS, but 
 *    themeable values are expressed as variables. 
 * 2) Set a max-width for demo purposes, although probably would
 *    let the card be fluid in production.
 */
.c-card {
  font-family: var(--card-font-family);
	font-size: var(--card-font-size);
	font-weight: var(--card-font-weight);
	border-width: var(--card-border-width);
	border-style: var(--card-border-style);
	border-color: var(--card-border-color);
	border-radius: var(--card-border-radius);
	background-color: var(--card-background-color);
  box-shadow: var(--card-box-shadow);
	color: var(--card-text-color);
	padding: var(--card-padding);
	text-transform: var(--card-text-transform);
	letter-spacing: var(--card-letter-spacing);
	transition: var(--card-transition);
  max-width: 380px; /* 2 */
  position: relative;
  box-sizing: border-box;
}

/**
 * Card Header
 * 1) Contains the card media
 */
.c-card__header {
  margin-bottom: var(--card-header-margin-bottom);
}

/**
 * Card Media
 * 1) Typically an image, but could be a video or iframe
 */
.c-card__media {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--card-media-border-radius);
}

/**
 * Card Body
 * 1) Contains the card title and description
 */
.c-card__body {
  text-align: var(--card-body-text-align);
  margin: var(--card-body-margin);
  padding: var(--card-body-padding);
  background: var(--card-body-background);
}

/**
 * Card Title
 * 1) The heading for a card (can be an h2, h3, or h4)
 */
.c-card__title {
  margin: var(--card-title-margin);
  padding: var(--card-title-padding);
  font-size: var(--card-title-font-size);
  background: var(--card-title-background-color);
  color: var(--card-title-text-color);
}

/**
 * Card Description
 * 1) A <p> tag that contains the card's primary text
 */
.c-card__description {
  font-family: var(--card-description-font-family);
  margin-bottom: 1rem;
  margin-top: 0;
}


/**
 * Card Footer
 * 1) A <p> tag that contains the card's primary text
 */
.c-card__footer {
  display: flex;
  justify-content: var(--card-footer-justify-content);
}






/*------------------------------------*\
    #THEME CUSTOM STYLES
\*------------------------------------*/

/**
 * 1) It's possible to add custom, non-tokenied styles
 *    to a themed component. This could end up opening 
 *    Pandora's Box that could end up undermining the 
 *    system, but if managed properly can help bring a
 *    sense of polish to individual brands while not
 *    forcing the system to accomodate every brand's
 *    quirk.
 */
.theme-1  {
  .c-card {
    overflow: hidden;
  }
  
  .c-btn {
    flex: 1;
  }
}

.theme-5 {
  .c-card__media {
    box-shadow: 4px 4px 4px rgba(0,0,0,0.12);
  }
  
  .c-card__body {
    position: relative;
    top: -4rem;
    right: -2rem;
    box-shadow: 4px 4px 4px rgba(0,0,0,0.12);
  }
  
  .c-card__footer {
    position: relative;
    top: -7em;
    right: -3rem;
  }
}
              
            
!

JS

              
                var themeSwitcher = document.querySelector('.theme-switcher');

themeSwitcher.addEventListener('change',function(){
    var themeName = this.value;
    console.log('name: '+themeName);
    document.body.className = "";
    document.body.classList.add(themeName);
});
              
            
!
999px

Console