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.

            
              <header class="page-header">
  <div class="container">
    <h1>Bootstrap Text and Picture Components</h1>
    <p class="lead">Flexbox Layout Examples</p>
  </div>
</header>

<div class="text-picture">
  <div class="container">
    <div class="row">
      <div class="col-sm-6 text-picture__text">
        <h2>Default Layout <small>without Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>
</div>

<div class="text-picture text-picture--gray-bg">
  <div class="container">
    <div class="row">
      <div class="col-sm-6 col-sm-push-6 text-picture__text">
        <h2>Default Layout <small>without Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 col-sm-pull-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>  
</div>

<div class="text-picture">
  <div class="container">
    <div class="row row--flex">
      <div class="col-sm-6 row--flex__col--center text-picture__text">
        <h2>Center Aligned <small>with Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>
</div>

<div class="text-picture text-picture--gray-bg">
  <div class="container">
    <div class="row row--flex">
      <div class="col-sm-6 row--flex__col--center col-sm-push-6 text-picture__text">
        <h2>Center Aligned <small>with Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 col-sm-pull-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>
</div>

<div class="text-picture">
  <div class="container">
    <div class="row row--flex">
      <div class="col-sm-6 row--flex__col--bottom text-picture__text">
        <h2>Bottom Aligned <small>with Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>
</div>

<div class="text-picture text-picture--gray-bg">
  <div class="container">
    <div class="row row--flex">
      <div class="col-sm-6 row--flex__col--bottom col-sm-push-6 text-picture__text">
        <h2>Bottom Aligned <small>with Flexbox</small></h2>
        <p>
          Ut sed congue massa. Cras eu turpis lacinia, ultricies ipsum fermentum, consectetur ipsum. Integer vestibulum a nunc noipsum. Integer vestibulum a nunc non facilisis.
        </p>
      </div>
      <div class="col-sm-6 col-sm-pull-6 text-picture__picture">
        <img src="http://placehold.it/640x340/?text=Image" alt="Image" class="img-responsive" />
      </div>
    </div>
  </div>
</div>

<footer>
  <p>This is a pen by <a href="https://codepen.io/danbhala">Dan Stuart</a>.</p>
</header>
            
          
!
            
              $grid-float-breakpoint: 768px;

body {
  font-family: 'Ubuntu', sans-serif;
  font-size: 16px;
}

.page-header {
  background-color: #dd4814;
  color: white;
  margin-top: 0;
  text-align: center;
  padding: 7.5% 0;
}

footer {
  background-color: #dd4814;
  text-align: center;
  color: white;
  padding: 2.5%;
  a {
    color: white;
    border-bottom: 1px dotted white;
    &:hover, &:active, &:focus {
      color: white;
      border-bottom: 1px solid white;
      text-decoration: none;
    }
  }
}

.text-picture {
  padding-top: 5%;
  padding-bottom: 5%;
  &.text-picture--gray-bg {
    background-color: #EEE;
  }
  .text-picture__text {
    h2 {
      margin-top: 0;
    }
    @media (min-width: $grid-float-breakpoint) {
      p:last-child {
          margin-bottom: 0;
      }
    }    
  }  
  .text-picture__picture {
    text-align: center;
    img {
      margin-left: auto;
      margin-right: auto;
    }
  }   
}

// I only want Flexbox to kick in for larger devices.
// i.e. I want to keep bootstraps mobile grid scaffolding intact.
@media (min-width: $grid-float-breakpoint) {
  .row--flex {
    display: flex;
    .row--flex__col {
      align-self: flex-start;
    }
    .row--flex__col--center {
      align-self: center;
    }
    .row--flex__col--bottom {
      align-self: flex-end;
    }
  }
}



            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console