cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              
<div class="main grid header-body-layout">
  <h1 class="center-x header">All About Sea Animals</h1>
  <div class="body grid">
    <div class="grid right-rail">
      <p>My son loves sea animals so I made this layout for him. I used CSS Grid to create an interactive layout that works with a mouse or touch. He uses on my phone mostly. Read all or read one. Enjoy!</p>
      <a class="open-all btn second">
        <div class="title">Read All</div>
      </a>
    </div>
  </div>
</div>
</div>
<div class="container main">
  <section class="grid close larger">
    <div class="content grid header-body-layout">
      <div class="header grid end-x">
        <a class="adjust-screen end-x"></a>
      </div>
      <div class="body grid center-y">
        <div class="grid right-rail">
          <div class="shark icon start-y center-x"></div>
          <p>Most sharks species will drown if they stop moving. Great white, mako and salmon sharks don't have the muscles they need to pump water through their mouth and over their gills. As long as they keep swimming, water keeps moving over their gills, keeping them alive.
          </p>
        </div>
        <div class="grid left-rail">
          <p>Sharks can use heartbeats to track their prey. Sharks have nodules on their noses about the size of a pimple, called ampullae of Lorenzini. These nodules sense electricity, so the electrical pulses that come from a beating heart can act like a beacon for nearby sharks
          </p>
          <div class="seaweed icon start-y center-x"></div>
        </div>
      </div>
    </div>

    <a class="trigger btn inline-grid">
      <div class="title">Sharks</div>
    </a>
  </section>
  <section class="grid close larger">
    <div class="content grid header-body-layout">
      <div class="header grid end-x">
        <a class="adjust-screen end-x"></a>
      </div>
      <div class="body grid center-y">
        <div class="grid right-rail">
          <div class="tortoise icon start-y center-x"></div>
          <p>They can smell with their throats. Like other reptiles, tortoises detect the faintest of smells with the vomeronasal organ, or Jacobson's Organ, on the roof of their mouths. Instead of flicking their tongues, they pump their throats to circulate air through the nose and around the mouth.
          </p>
        </div>
        <div class="grid left-rail">
          <p>The shell is 60 different bones. The most iconic feature of the tortoise is its shell, but in fact it isn’t a shell at all. A tortoise’s shell is made up of 60 different bones, all of which are connected to one another. The top of the shell is called a carapace, while the underside is called a plastron.
          </p>
          <div class="coral icon start-y center-x"></div>
        </div>
      </div>
    </div>

    <a class="trigger btn inline-grid">
      <div class="title">Tortoises</div>
    </a>
  </section>
  <section class="grid close larger">
    <div class="content grid header-body-layout">
      <div class="header grid end-x ">
        <a class="adjust-screen end-x"></a>
      </div>
      <div class="body grid center-y">
        <div class="grid right-rail">
          <div class="seahorse icon start-y center-x"></div>
          <p>Seahorses have no teeth and no stomach. Food passes through their digestive systems so quickly, they must eat almost constantly to stay alive.
          </p>
        </div>
        <div class="grid left-rail">

          <p>Seahorses are monogamous and mate for life.
Rarer still, they are among the only animal species on Earth in which the male bears the unborn young.
          </p>
          <div class="pink-coral icon start-y center-x"></div>
        </div>
      </div>
    </div>
    <a class="trigger btn inline-grid">
      <div class="title">Seahorses</div>
    </a>
  </section>
  <section class="grid close larger">
    <div class="content grid header-body-layout">
      <div class="header grid end-x">
        <a class="adjust-screen end-x"></a>
      </div>
      <div class="body grid center-y">
        <div class="grid right-rail">
          <div class="squid icon start-y center-x"></div>
          <p>Every squid features three hearts. They also move through the water tail first instead of head first
          </p>
        </div>
        <div class="grid left-rail">
          <p>Some of the larger squid can weigh more than 1,000 pounds.
Many species of squid have a life span that is only about one year.
          </p>
          <div class="seaweed icon start-y center-x"></div>
        </div>
      </div>
    </div>
    <a class="trigger btn inline-grid" href="#">
      <div class="title">Squids</div>
    </a>
  </section>
</div>
<!--[if IE]>
<style>
.close .content {
opacity: 1;
width:auto;
height: auto;
}
.container {
height: auto;
}
section {
padding: 40px 0px;
}
 a.btn {
border:3px dashed #000;
margin: 20px;
}
.content {
padding: 20px;
}
.adjust-screen, .open-all {
display: none;
}
.open {
background-color: #71b4e0;
}

.open a.btn {
padding: 10px 20px;
}
a.btn {
display: block;
}
.open .title {
-ms-transform: none !important;
transform: none !important;
}
</style>
<![endif]-->
            
          
!
            
              $color-1: #71b4e0;
$color-2: #9fc9ea;
$color-3: #4c98c6;
$color-4: #e6ebed;
$font-family: "Walter Turncoat", cursive;
$background: url();
$gutter: 30px;
$panel-number: 4;

body {
  font-family: $font-family;
  background: $color-2;
  p {
    font-size: 18px;
  }
}


/*
Layout Options
*/
body {
  display: grid;
  
}

.container {
  height: 100vh;
  display: flex;
  display: grid;
  grid-template-columns: repeat($panel-number, 1fr);
  overflow-y: hidden;
}

.container,
body {
  grid-template-areas: "main main";
  .main {
    grid-area: main;
    width: 100vw;
  }
}

.header-body-layout {
  grid-template-areas: "header header" "body body";
  grid-template-rows: auto 3fr;
  grid-template-columns: 2fr 2fr;
  width: 100%;
  .header {
    grid-area: header;
  }
  .body {
    grid-area: body;
      padding: 0 20px;
  }
  p {
    margin: 10px 0;
  }
}

/*
Base Grid - Container inline grid vs block (full width) grid
*/
.grid {
  display: flex;
  display: grid;
  
}
.inline-grid {
  display: inline-flex;
  display: inline-grid;

}
.full-width {
  grid-template-rows: 4fr;
}

.full-height {
  grid-template-columns: 4fr;
}
.grid-5 {
  grid-template-columns: repeat(5, 1fr);
  grid-column-gap: $gutter;
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
  grid-column-gap: $gutter;
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
  grid-column-gap: $gutter;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-column-gap: $gutter;
}

.left-rail {
  grid-template-columns: auto 3fr;
  grid-column-gap: $gutter;
}

.right-rail {
  grid-template-columns: 3fr auto;
  grid-column-gap: $gutter;
}

.left {
  float:left;
}
/*
Align child items - X Axis (Horizontal Alignment)
*/
.stretch-x {
  justify-items: stretch;
}

.end-x {
  justify-items: end;
  justify-self: end;
}

.center-x {
  justify-items: center;
  justify-self: center;
}
.end-y {
  align-items: end;
  align-self: end;
}
.center-y {
  align-items: center;
  align-self: center;
}

/*
Theme Styles
*/

h1 {
  font-size: 60px;
  padding: 20px 10px;
}

a.btn {

  text-decoration: none;
  font-size: 28px;
  background-color: $color-3;
  text-align: center;
  padding: 10px 20px;
  border-top: 3px dashed #000;
  border-right: 3px dashed #000;
  &:hover {
    background-color: $color-1;
  }
}
.btn.second {
  background-color: $color-1;
  border: 2px dashed #000;
  color: #000;
  font-size: 18px;
  padding:10px;
  max-width:100px;
  &:hover {
    background-color: $color-3;
    transition: all ease .5s;
  }
}
.content {
  font-size: 20px;
  color: #000;
  line-height: 22px;
}
/*
Trigger Styles
*/
.open-all {
  z-index: 101;
  position: relative;
  height: 20px;
}
.close {
  transition: all ease 1s;
  .content {
    background-color: $color-1;
    opacity: 0;
    width: 0;
    height: 0;
    transition: all ease 1s;
  }
  a.btn {
    align-items: initial;
    color: #000;
    transition: all ease 1s;
    height: 30px;
    align-self: end;

  }
  .title {
    transform: rotate(0deg);
    transition: all ease 1s;
  }
}

.open {
  grid-template-columns: 3fr auto;
  background-color: $color-3;
  width: 100vw;
  z-index: 0;
  .content {
    opacity: 1;
    width: 100%;
    height: 100vh;
    transition: all ease 0.5s;
    background-color: $color-1;
    overflow-y: auto;
    .adjust-screen {
      background-color: $color-3;
      align-self: start;
      justify-self: start;
      font-size: 28px;
      padding: 10px;
    }
  }
  a.btn {
    align-items: center;
    transition: all ease 1s;
    border-right: 3px dashed #000;
    border-left: 3px dashed #000;
    color: #000000;
    height: 100%;
    padding: 0;
    align-self: end;
    background-color: $color-3;
    &:hover {
      background-color: $color-1;
    }
  }
  .title {
    transform: rotate(90deg);
    font-size: 24px;
  }
}
.larger.open {
  z-index: 102;
  .adjust-screen {
    &:after {
      content: "-";
      display: block;
    }
    &:hover {
      background-color: $color-2;
    }
  }
}
.smaller.open {
  z-index: 102;
  width: 50vw;
  .adjust-screen::after {
    content: "+";
    display: block;
  }
  .content {
    width: 100%;
    transition: none !important;
  }
}

/*
Icons
*/
.icon--sm {
  background-size: 100% auto;
  background-repeat: no-repeat;
  width: 2em;
  height: 2em;
  display: inline-block;
}

.icon {
  background-size: 100% auto;
  background-repeat: no-repeat;
  width: 5em;
  height: 5em;
}
.shark {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/034-shark.svg");
}

.seaweed {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/016-seaweed.svg");
}

.tortoise {
  background-image: url("  https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/050-tortoise.svg");
}
.coral {
  background-image: url("  https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/018-coral-3.svg");
}

.seahorse {
  background-image: url("    https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/049-seahorse.svg");
}

.squid {
  background-image: url("    https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/044-squid.svg");
}

.pink-coral {
  background-image: url("      https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/020-coral-1.svg");
}

.pink-fish {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/010-fish-7.svg");
  opacity: 0;
}

.green-fish {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/734275/008-fish-8.svg");
  opacity:0;
}
/*
Media Queries
*/
@media (max-width: 575px) {
}

// Small devices (landscape phones, less than 768px)
@media (max-width: 767px) {
  h1 {
    font-size: 30px;
    padding: 20px 10px;
  }
  a.btn {
    padding: 10px 5px 0;
  }
  .title {
    font-size: 18px;
  }
  .left-rail {
    grid-template-columns: 4fr;
    grid-column-gap: $gutter;
  }

  .right-rail {
    grid-template-columns: 4fr;
    grid-column-gap: $gutter;
  }
  .icon {
    background-size: 100% auto;
    background-repeat: no-repeat;
    width: 6em;
    height: 6em;
  }
}

// Medium devices (tablets, less than 992px)
@media (max-width: 991px) {
}

// Large devices (desktops, less than 1200px)
@media (max-width: 1199px) {
}

/*
Animations
*/
.bounce {
  animation: bounce 1s forwards;
}

.delay {
    animation-delay: .25s;
}
@keyframes bounce {
  0% {
    opacity: 1;
    transform: scale(.9);
  }
  25% {
     opacity: 1;
    transform: scale(1);  
  }
  50% {
    opacity: 1;
    transform: scale(.9);
  }

  75% {
      opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
     transform: scale(1);
  }
}

            
          
!
            
              $( ".open-all" ).click(function() {
  $("body").find("section").toggleClass( "open" );
});

$( ".trigger" ).click(function() {
  $(this).parent().toggleClass( "open" );
});

$( ".adjust-screen" ).click(function() {
  $(this).parent().parent().parent().toggleClass( "smaller" );
});

            
          
!
999px
Loading ..................

Console