Marketing Site Hero Section

By Rafi

F6
#
How do I use This?

A responsive hero section with a background image. On mobile the image shifts focus so the text is readable.

HTML
<div class="marketing-site-hero">
  <div class="marketing-site-hero-content">
    <h1>Yeti Snowcone Agency</h1>
    <p class="subheader">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam omnis, maxime libero natus qui minus!</p>
    <a href="#" class="round button">learn more</a>
  </div>
</div>

$marketing-site-hero-height: 65vh;

.marketing-site-hero {
  background: url('https://images.pexels.com/photos/8264/pexels-photo.jpg?h=350&auto=compress&cs=tinysrgb') top right no-repeat;
  height: $marketing-site-hero-height;
  background-size: cover;
  display: flex;
  align-items: center;

  @media screen and (min-width: 40em) {
    background-position: center center;
  }
}

.marketing-site-hero-content {
  max-width: $global-width;
  margin: 0 auto;
  padding-left: 5%;
  padding-right: 5%;

  h1 {
    font-size: 32px;
  }

  .button.round {
    border-radius: 5000px;
    text-transform: uppercase;
    font-size: 12px;
    margin-bottom: 0;
  }

  @media screen and (min-width: 40em) {
    padding-left: 50%;
  }
}


.marketing-site-hero {
  background: url("https://images.pexels.com/photos/8264/pexels-photo.jpg?h=350&auto=compress&cs=tinysrgb") top right no-repeat;
  height: 65vh;
  background-size: cover;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
}

@media screen and (min-width: 40em) {
  .marketing-site-hero {
    background-position: center center;
  }
}

.marketing-site-hero-content {
  max-width: 75rem;
  margin: 0 auto;
  padding-left: 5%;
  padding-right: 5%;
}

.marketing-site-hero-content h1 {
  font-size: 32px;
}

.marketing-site-hero-content .button.round {
  border-radius: 5000px;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 0;
}

@media screen and (min-width: 40em) {
  .marketing-site-hero-content {
    padding-left: 50%;
  }
}

JS