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

              
                <header class="header">
  <div class="container">
    <nav class="row">
      <div class="col-1-3">
        <a href="#" class="logo">
          <img alt="Company Name" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/logo.png">
        </a>
      </div>
      <div class="col-2-3">
        <ul class="nav">
          <li><a href="#" class="btn btn--nav">Lorem Ipsum Dolor</a></li>
          <li><a href="#" class="btn btn--nav">Lorem Ipsum</a></li>
          <li><a href="#" class="btn btn--nav">Lorem Ipsum Dolor</a></li>
          <li><a href="#" class="btn btn--primary">Lorem Ipsum</a></li>
        </ul>
      </div>
    </nav>
  </div>
</header>
<main>
  <section class="hero">
    <div class="bg-image">
      <img srcset="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/hero-sm.jpg 780w,
                   https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/hero.jpg 1400w" alt="background condiments and cookware">
    </div>
    <div class="container">
      <h1 class="hero__header">Lorem Ipsum</h1>
      <p class="hero__body">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent vitae odio sollicitudin, convallis mauris vitae, rhoncus leo. Nam vehicula lacus nec laoreet luctus. Sed eu.
      </p>
      <a href="#" class="btn btn--hero">Lorem Ipsum Dolor</a>
    </div>
  </section>
  <section class="intro">
    <div class="container">
      <div class="row sm-row-reverse">
        <div class="col-1-3">
          <div class="intro__image frame--circle mask--orange"><img src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/cooking.jpg"></div>
        </div>
        <div class="col-2-3">
          <h3 class="intro__heading">Lorem Ipsum Dolor Sit Amet</h3>
          <p class="intro__body">
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus nunc id congue mattis. Sed vel tincidunt enim. Aliquam sollicitudin nisl sit amet ullamcorper eleifend. Curabitur feugiat urna a purus fringilla.
          </p>
        </div>
      </div>
    </div>
  </section>
  <section class="features">
    <div class="container">
      <div class="row">
        <div class="col-1-3">
          <article class="feature">
            <div class="feature-thumbnail feature-green">
              <div class="bg-image bg-image--feature">
                <img alt="feature-1" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/feature-1.jpg">
              </div>
              <div class="feature-tag">Lorem Ipsum</div>
              <div class="feature-more">
                <a href="#" class="btn btn--feature">Read More &gt;</a>
              </div>
            </div>
            <div class="feature-text">
              <h3 class="feature-heading">Lorem Ipsum</h3>
              <p class="feature-body">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum interdum urna et interdum. Integer lacinia orci et felis porta, porta tristique augue sodales. <br>
                <a href="#">Read more &gt;</a>
              </p>
            </div>
          </article>
        </div>
        <div class="col-1-3">
          <article class="feature">
            <div class="feature-thumbnail feature-orange">
              <div class="bg-image bg-image--feature">
                <img alt="feature-2" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/feature-2.jpg">
              </div>
              <div class="feature-tag">Lorem Ipsum</div>
              <div class="feature-more">
                <a href="#" class="btn btn--feature">Read More &gt;</a>
              </div>
            </div>
            <div class="feature-text">
              <h3 class="feature-heading">Lorem Ipsum</h3>
              <p class="feature-body">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum interdum urna et interdum.<br>
                <a href="#">Read more &gt;</a>
              </p>
            </div>
          </article>
        </div>
        <div class="col-1-3">
          <article class="feature">
            <div class="feature-thumbnail feature-tan">
              <div class="bg-image bg-image--feature">
                <img alt="feature-3" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/feature-3.jpg">
              </div>
              <div class="feature-tag">Lorem Ipsum</div>
              <div class="feature-more">
                <a href="#" class="btn btn--feature">Read More &gt;</a>
              </div>
            </div>
            <div class="feature-text">
              <h3 class="feature-heading">Lorem Ipsum</h3>
              <p class="feature-body">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc fermentum interdum urna et interdum. Integer lacinia orci et felis porta, porta tristique augue sodales. <br>
                <a href="#">Read more &gt;</a>
              </p>
            </div>
          </article>
        </div>
      </div>
    </div>
  </section>
  <section class="testimonial">
    <div class="bg-image bg-image--align-top">
      <img alt="testimonial background" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/testimonial-bg.jpg">
    </div>
    <div class="container">
      <div class="testimonial__rating testimonial__rating--xs-fix">
        <i class="fa fa-star" aria-hidden="true"></i>
        <i class="fa fa-star" aria-hidden="true"></i>
        <i class="fa fa-star" aria-hidden="true"></i>
        <i class="fa fa-star" aria-hidden="true"></i>
        <i class="fa fa-star" aria-hidden="true"></i>
      </div>
      <div class="testimonial__body">
        <q>Lorem ipsum dolor sit amet, consecteteur adipiscing elit. Donec finibus nunc id congue
          mattis. Sed vel tincidunt enim. Aliquam sollicitudin nisl sit amet ullamcorper eleifend.
          Curabitur feugiat urna a purus fringilla.</q>
        <span class="testimonial__author">Lorem Ipsum</span>
      </div>
    </div>
  </section>
  <section class="media-section">
    <div class="container">
      <div class="row">
        <div class="col-1-2">
          <section class="media">
            <div class="media__icon"><i class="fa fa-pagelines" aria-hidden="true"></i></div>
            <div class="media__content">
              <h4 class="media__heading">Lorem Ipsum Dolor</h4>
              <p class="media__body">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus nunc id congue mattis. Sed vel tincidunt enim. Aliquam sollicitudin nisl sit amet ullamcorper eleifend.
              </p>
              <button class="btn btn--primary">Lorem Ipsum</button>
            </div>
          </section>
        </div>
        <div class="col-1-2">
          <section class="media">
            <div class="media__icon font125px"><i class="fa fa-tags" aria-hidden="true"></i></div>
            <div class="media__content">
              <h4 class="media__heading">Lorem Ipsum Dolor</h4>
              <p class="media__body">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec finibus nunc id congue mattis. Sed vel tincidunt enim. Aliquam sollicitudin nisl sit amet ullamcorper eleifend.
              </p>
              <button class="btn btn--primary">Lorem Ipsum</button>
            </div>
          </section>
        </div>
      </div>
    </div>
  </section>
</main>
<footer class="footer">
  <div class="container">
    <div class="row">
      <div class="col-1-3">
        <a href="#" class="logo logo--footer">
          <img alt="Company Name" src="https://cdn.rawgit.com/tjsantos/css/5b6c49af/images/logo.png">
        </a>
      </div>
      <div class="col-1-4">
        <div class="footer-address-container">
          <i class="fa fa-map-marker footer-address-icon"></i>
          <address class="footer-address">
            Company Name<br>
            5555 Address St. #555<br>
            City, State 55555
          </address>
        </div>
      </div>
      <div class="col-1-6">
        <div class="footer-contact">
          <a href="tel:1-555-123-4567">
            <i class="fa fa-phone-square footer-contact-icon"></i>555.123.4567
          </a>
        </div>
      </div>
      <div class="col-1-4">
        <div class="footer-social">
          <a href="#" class="footer-social-icon"><i class="fa fa-twitter"></i></a>
          <a href="#" class="footer-social-icon"><i class="fa fa-facebook"></i></a>
          <a href="#" class="footer-social-icon"><i class="fa fa-google-plus-official"></i></a>
          <a href="#" class="footer-social-icon"><i class="fa fa-foursquare"></i></a>
        </div>
      </div>
    </div>
  </div>
  <div class="footer-divider"></div>
  <div class="container">
    <div class="row footer-legal">
      <div class="col-1-3">
        <!-- empty -->
      </div>
      <div class="col-1-4">
        COPYRIGHT 2017. ALL RIGHTS RESERVED
      </div>
      <div class="col-1-6">
        <a href="#">PRIVACY POLICY</a>
      </div>
      <div class="col-1-4">
        <a href="#">TERMS OF USE</a>
      </div>
    </div>
  </div>
</footer>
              
            
!

CSS

              
                /** Based on the target design documents:
* https://github.com/tjsantos/css/blob/master/design.pdf
* https://github.com/tjsantos/css/blob/master/redline.pdf
* https://github.com/tjsantos/css/blob/master/style-guide.pdf
*/

/*** Reset ***/
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}


/*** Variables, Mixins ***/
$gutter-margin: 15px;
$small-min-width: 48em;  /* 768px for default 16px/em */
$extra-small-max-width: $small-min-width - 0.0625;  /* removing 1 pixel */
$medium-min-width: 62em;
$max-content-width: 75rem; /* large device breakpoint = 1200px */

@mixin extra-small-only() {
  @media only screen and (max-width: $extra-small-max-width) {
    @content;
  }
}

@mixin small-and-above() {
  @media only screen and (min-width: $small-min-width) {
    @content;
  }
}

@mixin medium-and-above() {
  @media only screen and (min-width: $medium-min-width) {
    @content;
  }
}

@mixin flex-column($fraction) {
  flex: 0 0 percentage($fraction);
  // Add a `max-width` to ensure content within each column does not blow out
  // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
  // do not appear to require this.
  max-width: percentage($fraction);
}

@function pem($pixels, $base: 16px) {
  @if (unitless($pixels)) {
    $pixels: $pixels * 1px;
  }

  @if (unitless($base)) {
    $base: $base * 1px;
  }

  @return $pixels / $base * 1em;
}


/*** Grid ***/
.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: $gutter-margin;
  padding-right: $gutter-margin;
  max-width: $max-content-width;
}

.row {
  margin-left: -$gutter-margin;
  margin-right: -$gutter-margin;

  display: flex;
  flex-flow: column;

  [class*='col-'] {
    position: relative;
    padding-left: $gutter-margin;
    padding-right: $gutter-margin;
    width: 100%;
  }

  @include medium-and-above() {
    flex-flow: row;

    .col-1-2 {
      @include flex-column(1/2);
    }

    .col-1-3 {
      @include flex-column(1/3);
    }

    .col-1-4 {
      @include flex-column(1/4);
    }

    .col-1-6 {
      @include flex-column(1/6);
    }

    .col-2-3 {
      @include flex-column(2/3);
    }

    &.sm-row-reverse {
      flex-direction: row-reverse;
    }
  }
}


/*** Colors ***/
$light-brown: #9b8579;
$brown: #594a42;
$green: #8dc63f;
$orange: #f7941e;
$tan: #c49a6c;
$dark-gray: #414042;
$medium-sea-green: #39b54a;
$linen: #e7e1d7;


/*** Base Styles ***/
html {
  font-size: 100%;
}

body {
  color: $dark-gray;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: normal;
}

h1, h2, h3 {
  font-weight: bold;
}

a {
  color: $green;
  font-weight: bold;

  &:hover, &:focus {
    text-decoration: underline;
  }

  &[href^='tel:'] {
    text-decoration: none;
    font-weight: normal;
  }
}


/*** Themes ***/
.feature-green {
  background: $green;
}

.feature-orange {
  background: $orange;
}

.feature-tan {
  background: $tan;
}


/*** Button Modules ***/
.btn {
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  background-image: none;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;

  padding: 12px 30px;
  font-size: pem(21px);
  font-weight: bold;
  border-radius: 4px;
  line-height: 1;

  transition: all 0.3s ease 0s;

  @include medium-and-above() {
    padding: 10px 15px;
    font-size: pem(18px);
    font-weight: normal;
  }
}

.btn--primary {
  color: #fff;
  background: $green;
  border-color: $green;

  &:hover, &:focus {
    background: none;
    border-color: #fff;
    text-decoration: none;
  }
}

.btn--hero {
  white-space: normal;
  color: #fff;
  border-color: #fff;
  padding: 15px 30px;
  font-size: pem(28px);
  text-transform: uppercase;
  font-weight: normal;

  &:hover, &:focus {
    background: #fff;
    color: $medium-sea-green;
    text-decoration: none;
  }
}

.btn--nav {
  color: #fff;
}


/*** Header and Navigation Modules ***/
.header {
  background: $light-brown;
  color: #fff;
  padding-top: 18px;
  padding-bottom: 18px;

  @include medium-and-above() {
    padding-top: 30px;
    background: transparent;
    position: absolute;
    z-index: 9999;
    width: 100%;
  }
}

.nav {
  list-style: none;
  margin: 23px 0 0;  // 35px minus 12px padding
  padding: 0;
  display: flex;
  flex-flow: column;
  align-items: center;

  @include medium-and-above() {
    flex-flow: row;
    margin-top: 0;
    height: 100%;
    justify-content: space-between;
    align-items: flex-end;
  }

  > :last-child {
    margin-top: 12px;
    @include medium-and-above() {
      margin-top: 0;
    }
  }
}

.logo {
  overflow: hidden;
  display: block;
  width: 64px;
  height: 64px;
  margin-left: auto;
  margin-right: auto;

  @include medium-and-above() {
    overflow: visible;
    width: auto;
    height: 50px;
  }

  img {
    height: 100%;
  }
}


/*** Hero Modules ***/
.hero {
  color: #fff;
  text-align: center;
  padding-top: 80px;
  padding-bottom: 25px;
  position: relative;

  @include medium-and-above() {
    padding-top: 150px;
    padding-bottom: 110px;
  }
}

.hero__header {
  margin: 0 auto;
  font-size: pem(42px);
  font-weight: bold;
}

.hero__body {
  margin: 50px auto;
  font-size: pem(24px);
  line-height: 1.8;
  max-width: 40em;
  @include medium-and-above() {
    font-size: pem(26px);
    line-height: 1.65;
  }
}

// centered background image controlled by child img element,
// requires position: relative on parent container
.bg-image {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  overflow: hidden;

  img {
    position: absolute;
    min-width: 100%;
    min-height: 100%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-color: $brown;
    opacity: 0.55;
  }

  ~ * {
    position: relative;
  }
}

.bg-image--align-top {
  img {
    left: 50%;
    top: 0;
    transform: translate(-50%, 0%);
  }
}


/*** Intro Modules ***/
.intro {
  text-align: center;
  padding-top: 25px;
  padding-bottom: 55px;
  @include medium-and-above() {
    text-align: left;
    padding-top: 50px;
  }
}

.intro__heading {
  margin: 0;
  font-size: pem(32px);
  font-weight: bold;
  line-height: 1.5;
  @include medium-and-above() {
    font-size: pem(36px);
    margin-bottom: 0.2em;
  }
}

.intro__body {
  margin: 0;
  font-size: pem(24px);
  line-height: 1.75;
  max-width: 40em;
  @include medium-and-above() {
    font-size: pem(26px);
    line-height: 1.65;
  }
}

.intro__image {
  height: 200px;
  width: 200px;
  margin: 0 auto 40px;

  img {
    width: 100%;
  }

  //noinspection CssOptimizeSimilarProperties
  @include medium-and-above() {
    width: 355px;
    max-width: 100%;
    height: auto;
    position: relative;
    top: pem(-(30px + 50px));
    margin: 0;
    // want 63px below relatively positioned image
    // subtract relative positioning (30 + 50) and bottom padding of container (55)
    margin-bottom: pem(63 - ((30 + 50) + 55));
  }
}

.frame--circle {
  border-radius: 50%;
  overflow: hidden;
}

.mask--orange {
  position: relative;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: $orange;
    opacity: 0.6;
  }
}


/*** Media Modules ***/
.media-section {
  background: $linen;
  padding-top: 20px;
  padding-bottom: 20px;
}

.media {
  padding-top: 20px;
  padding-bottom: 20px;
  display: flex;
  flex-flow: wrap;
  justify-content: center;
}

.media__icon {
  font-size: 150px;
  color: $brown;
  width: 160px;
}

.media__content {
  flex: 1;
  line-height: 1.6;
}

.media__heading {
  margin: 0;
  font-size: pem(28px);
  font-weight: bold;
}

.media__body {
  font-size: pem(18px);
  margin: 0 0 40px;
  padding-right: 20px;
}

.font125px {
  font-size: 125px !important;
}


/*** Features ***/
.feature-thumbnail {
  padding-top: 4px;
  height: pem(200px + 4px);
  position: relative;
  margin: 0 (-$gutter-margin);
  @include medium-and-above() {
    margin: 0;
  }
}

.feature-tag {
  position: absolute;
  left: 0;
  top: 4px;
  height: 50px;
  padding: 10px 35px 10px 15px;
  background: inherit;
  color: #fff;
  font-size: pem(24px);
  font-weight: normal;
  line-height: 1;
  @include medium-and-above() {
    height: 40px;
    padding: 8px 25px 10px 10px;
    font-size: pem(21px);
  }
}

.bg-image--feature {
  top: 4px;

  &::after {
    opacity: 0.75;

    visibility: hidden;
    @include medium-and-above() {
      visibility: visible;
    }
  }
}

.btn--feature {
  white-space: nowrap;
  color: #fff;
  border-color: #fff;
  padding: 10px 15px;
  font-size: pem(18px);
  text-transform: uppercase;
  font-weight: normal;

  &:hover, &:focus {
    background: #fff;
    color: $medium-sea-green;
    text-decoration: none;
  }
}

.feature-more {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  // compensate the 'left: 50%' rule which reduces the available width for the element by 50%
  margin-right: -50%;

  visibility: hidden;
  @include medium-and-above() {
    visibility: visible;
  }
}

.feature-text {
  margin: 20px 0 40px;
  @include medium-and-above() {
    margin-bottom: 50px;
  }
}

.feature-heading {
  font-size: pem(28px);
  font-weight: bold;
  margin: 0.1em 0;
}

.feature-body {
  font-size: pem(18px);
  margin: 0;
  line-height: 1.6;
}


/*** Testimonial ***/
.testimonial {
  position: relative;
  color: #fff;
  text-align: center;
  padding-top: 40px;
  padding-bottom: 40px;
  opacity: 0.75;
  @include medium-and-above() {
    padding-top: 60px;
    padding-bottom: 60px;
  }
}

.testimonial__rating {
  font-size: 60px;
  line-height: 1.3;
  text-shadow: 0 0 8px #000;
  @include medium-and-above() {
    font-size: 72px;
  }
}

.testimonial__rating--xs-fix {
  // override style guide so that rating is smaller and doesn't wrap on mobile
  @media only screen and (max-width: 400px) {
    font-size: 48px;
  }
}

.testimonial__body {
  margin-top: 50px;
  font-size: pem(24px);
  font-style: italic;
  line-height: 1.75;

  @include medium-and-above() {
    max-width: 35em;
    margin: 60px auto 0;
    font-size: pem(26px);
  }
}

.testimonial__author {
  display: inline-block;
  font-weight: bold;
  font-style: normal;

  &::before {
    content: ' - ';
  }
}


/*** Footer ***/
.footer {
  background: $brown;
  color: $light-brown;
  text-align: center;
  margin-top: 5px;
  padding-top: 20px;
  padding-bottom: 20px;
  font-size: pem(18px);

  a {
    color: $light-brown;
    font-weight: normal;
  }

  @include medium-and-above() {
    text-align: unset;
    padding-top: 35px;
  }
}

.footer-divider {
  @include medium-and-above() {
    min-height: 1px;
    background: #fff;
    margin-top: 30px;
    margin-bottom: 10px;
  }
}

.logo--footer {
  height: 35px;
  width: auto;
  margin-bottom: 40px;
  @include medium-and-above() {
    height: 50px;
    margin-bottom: unset;
    margin-top: (20px - 35px);
  }
}

.footer-address-container {
  line-height: 1.45;
  margin-bottom: 35px;

  &::first-line {
    font-weight: bold;
  }

  @include medium-and-above() {
    display: flex;
    margin-bottom: unset;
  }
}

.footer-address-icon, .footer-contact-icon {
  font-size: pem(26px, 18px) !important;
  @include medium-and-above() {
    font-size: pem(32px, 18px) !important;
  }
}

.footer-address-icon {
  margin-right: 0.2em;
}

.footer-contact-icon {
  margin-right: 0.6em;
  @include medium-and-above() {
    margin-right: 0.4em;
  }
}

.footer-social-icon {
  font-size: pem(28px, 18px) !important;
  display: inline-block;
  margin-right: 1.1em;
  @include medium-and-above() {
    margin-right: 0.8em;
  }

  &:last-of-type {
    margin-right: 0;
  }
}

.footer-address {
  display: inline;
  font-style: normal;

  @include medium-and-above() {
    // element becomes a flex item
    margin-left: 0.3em;
    margin-top: 0.3em;

    &::first-line {
      font-weight: bold;
    }
  }
}

.footer-contact {
  margin-bottom: 40px;
  @include medium-and-above() {
    margin-bottom: unset;
  }
}

.footer-social {
  margin-bottom: 20px;
  @include medium-and-above() {
    margin-bottom: unset;
  }
}

.footer-legal {
  font-size: pem(12px, 18px);
  line-height: 1.7;
}

              
            
!

JS

              
                
              
            
!
999px

Console