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

              
                <!DOCTYPE html>
<html>
  <head>
    <title>Vertical Grid</title>

    <link rel="stylesheet" type="text/css" href="style.css">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  </head>

  <body>
    <header>
      <input type="checkbox" name="" value="" id="vertical-grid">
      <label for="vertical-grid"> View grid </label>
      <div class="vertical-grid"></div>
    </header>

    <div class="wrapper"">
      <aside class="sidebar">
        <a href="#"> Sidebar Link </a>
        <a href="#"> Another Sidebar Link </a>
        <a href="#"> Link in the Sidebar </a>
      </aside>

      <main>
        <h1> Vertical Grid: </h1>
        <h2> An introductory sandbox </h2>

        <p class="intro">
          This is me; playing with how to create a vertical grid and maintain it.
        </p>
        
         <div class="columns columns--2">
          <div>
          <h3> Typography </h3>
          <h4> Headers and body text </h4>
          <p>
            Wash. You gotta be kitten me right meow What a cat-ass-trophy! soft kitty
            warm kitty little ball of furr sniff sniff, yet lick left leg for
            ninety minutes, still dirty.
          </p>

          <p>
            Tickle my belly at your own peril i will pester for food when you're in
            the kitchen even if it's salad cats making all the muffins and instantly
            break out into full speed gallop across the house for no reason sniff
            sniff but cough. Cat mojo love and coo around boyfriend who purrs and
            makes the perfect moonlight eyes so i can purr and swat the glittery
            gleaming yarn to him (the yarn is from a $125 sweater) for claw your
            carpet in places everyone can see - why hide my amazing artistic
            clawing skills?, thug cat.
          </p>
          <ul>
            <li>Ooh, are those your $250 dollar sandals?</li>
            <li>Lemme use that as my litter box behind the couch,</li>
            <li>but if human is on laptop sit on the keyboard sit in window and stare</li>
            <li>oooh, a bird, yum and stinky cat purr while eating.</li>
          </ul>

          <p>
            Pet me pet me don't pet me i like frogs
            and 0 gravity so attack feet. Destroy couch mrow sleeps on my head
            suddenly go on wild-eyed crazy rampage or chase after silly colored
            fish toys around the house so eats owners hair then claws head for hiss
            at vacuum cleaner.
          </p>
         </div>

         <div>
          <h3> Forms & Buttons </h3>
          <p>
            Things and stuff, there are more words so that I can see if the things line up across columns and I think that they might and I'm really pumped about it.
          </p>
          <div class="form">
            <h4> Basic Information </h4>
            <div class="form__field">
              <label for="text">Name</label>
              <input type="text" id="text" value="">
            </div>

            <div class="form__field">
              <label for="street">Street Address</label>
              <input class="input--full-width" type="text" id="street" name="" value="">
            </div>

            <div class="form__group">
              <div class="form__field">
                <label for="city">City</label>
                <input type="text" id="city" name="" value="">
              </div>

              <div class="form__field">
                <label for="state">State</label>
                <input type="text" id="state" name="" value="">
              </div>

              <div class="form__field">
                <label for="zip">Zip Code</label>
                <input type="number" id="zip" name="" value="">
              </div>
            </div>

            <div class="form__actions">
              <a href="#" class="button">Cancel</a>
              <a href="#" class="button button--cta">Update Basic Information</a>
            </div>
          </div>
                                                    
          <div class="form">
            <h4> Contact Information </h4>
            <div class="form__field">
              <label for="email">Email</label>
              <input type="email" id="email" value="">
            </div>

            <div class="form__field">
              <label for="phone">Phone Number</label>
              <input type="phone" id="phone" name="" value="">
            </div>

            <div class="form__actions">
              <a href="#" class="button">Cancel</a>
              <a href="#" class="button button--cta">Update More Information</a>
            </div>
          </div>
         </div>
        </div>
      </main>
    </div>
  </body>
</html>

              
            
!

CSS

              
                ///////////////////
// Establish the Grid
///////////////////

// Grid Variables
// Play with these to modify the grid!
$font-size-base: 20px;
$line-height-base: 1.5;
$grid: $font-size-base * $line-height-base;

// Grid Function
@function grid($count) {
  @return calc(#{$grid} * #{$count});
}

// Reset browser defaults

body, html {
  margin: 0;
  padding: 0 1em;
}

h1,
h2,
h3,
h4,
h5,
h6,
ol,
ul,
blockquote,
p {
  margin: 0;
}

* {
  box-sizing: border-box;
  line-height: grid(1);
}




//////////////////
// Visual Styles and Using the Grid
//////////////////

// Functions

@function hover($color) {
  @return darken($color, 15%);
}

// Variables

// Color

$gray: #555;
$gray-light: #999;
$gray-lightest: #ededed;

$color-cta: #69c3e2;
$color-danger: #e05851;
$color-info: #eacd1f;

// Units
$unit-xs: 2px;
$unit-sm: 4px;
$unit-md: 8px;
$unit-lg: 16px;
$unit-xl: 32px;


// Typography
* {
  box-sizing: border-box;
  font-family: Helvetica, Arial;
}

body, html {
  color: #222;
}

h1 {
  font-size: 2.5em;
  line-height: grid(2);
  margin-bottom: grid(1);
}

h2 {
  font-size: 2em;
  line-height: grid(2);
  margin-bottom: grid(1);
}

h3 {
  font-size: 1.5em;
  line-height: grid(2);
}

h4 {
  color: $gray;
  font-size: 1.25em;
}

h5 {
  font-size: 1em;
}

h6 {
  font-size: .9em;
}

p + h1,
p + h2,
p + h3,
p + h4,
p + h5,
p + h6 {
  margin-top: grid(1);
}

.intro {
  font-size: 1.25em;
}

p {

  + p {
    margin-top: grid(1);
    margin-bottom: grid(1);
  }
}

ul,
ol {
  margin-top: grid(1);
  margin-bottom: grid(1);
  padding-left: 1em;
}


// Sidebar
.sidebar {
  background-color: $gray-lightest;
  border-radius: $unit-sm;
  flex-grow: 1;
  margin-right: 2em;
  padding: grid(1);

  a {
    color: $gray;
    display: block;
    margin: grid(.5) 0;
    text-decoration: none;

    :hover,
    :active,
    :focus {
      color: hover($gray);
    }
  }
}

// Form
.form {

  &__field {
    margin-bottom: grid(1);
  }

  &__group {
    display: flex;
      align-items: flex-start;
      justify-content: flex-start;
      flex-wrap: wrap;

    .form__field {
      margin-right: 1em;
    }
  }

  &__actions {
    margin-top: grid(1);
  }

  + .form {
    margin-top: grid(3);
  }
}

label {
  display: block;
  font-size: .8em;
  font-weight: bold;
  line-height: grid(1);
}

.input {

  &--full-width {
    width: 100%;
  }
}

input {
  border: 1px solid $gray-light;
  border-radius: $unit-sm;
  box-shadow: none;
  box-sizing: border-box;
  font-size: .9em;
  height: grid(1);
  outline: none;
  padding: 0 .5em;

  &[type=text],
  &[type=textarea],
  &[type=number],
  &[type=phone],
  &[type=email] {

    &:hover {
      border-color: hover($gray-light);
    }

    &:focus {
      border-color: $color-info;
    }
  }

  &[type=radio],
  &[type=checkbox] {
    height: initial;

    + label {
      display: inline;
    }
  }
}

// Button
.button {
  background-color: $gray;
  border-radius: $unit-sm;
  color: white;
  display: inline-flex;
    align-items: center;
    justify-content: center;
  font-size: .8em;
  height: grid(1);
  padding: 0 2em;
  text-decoration: none;
  transition: all .3s ease;

  &:hover,
  &:active,
  &:focus {
    background-color: hover($gray);
  }

  &--cta {
    background-color: $color-cta;

    &:hover,
    &:active,
    &:focus {
      background-color: hover($color-cta);
    }
  }

  + .button {
    margin-right: 1em;
  }
}


// Layout 
.wrapper {
  display: flex;
    align-items: flex-start;
  margin: auto;
  max-width: 1200px;
  padding-bottom: grid(4);

  @media screen and (max-width: 768px) {
    display: block;
  }
}

header {
  padding: $grid 0;
}

main {
  flex-basis: 75%;
  padding-bottom: 2em;
}

.columns {
  display: grid;
  grid-gap: $grid;
  
  &--2 {
    grid-template-columns: 1fr 1fr;
  }
}







/////////////////
// View Grid in Background
/////////////////
$minus-one: calc(#{$grid} - 1px);

.vertical-grid {
  background: repeating-linear-gradient(
    transparent,
    transparent $minus-one,
    #e05851 $minus-one,
    #e05851 $grid
  );
  display: none;
  height: 400%;
  position: absolute;
    left: 0;
    top: 0;
  width: 100%;
  z-index: -100;
}

#vertical-grid:checked ~ .vertical-grid {
  display: block;
}

              
            
!

JS

              
                
              
            
!
999px

Console