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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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
Loading ..................

Console