Pen Settings

HTML

CSS

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.

+ 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

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.

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

              
                <div class="container">
  <h1>Bootstrap 3 <code>@screen-xs-max</code></h1>
  <p class="alert"><code>@screen-xs-max</code> is an important variable for custom breakpoints! In this case, I needed it to avoid a 1px conflict with my <code>col-sm-4</code> columns which was breaking layout in the iPad mini. Sample code, the LESS problem and fix, and an explanation are below.</p>

<h2>Columns</h2>

<div class="row">
    <div class="col-sm-4">
        <h3>col-sm-4</h3>
        <p>Suspendisse et arcu felis, ac gravida turpis. Suspendisse potenti. Ut porta rhoncus ligula, sed fringilla felis feugiat eget. In non purus quis elit iaculis tincidunt. Donec at ultrices est.</p>
        <p><a class="btn btn-primary pull-right" href="#">btn pull-right</a></p>
    </div>
    <div class="col-sm-4">
        <h3>col-sm-4</h3>
        <p>Suspendisse et arcu felis, ac gravida turpis. Suspendisse potenti. Ut porta rhoncus ligula, sed fringilla felis feugiat eget. In non purus quis elit iaculis tincidunt. Donec at ultrices est.</p>
        <p><a class="btn btn-primary pull-right" href="#">btn pull-right</a></p>
    </div>
    <div class="col-sm-4">
        <h3>col-sm-4</h3>
        <p>Suspendisse et arcu felis, ac gravida turpis. Suspendisse potenti. Ut porta rhoncus ligula, sed fringilla felis feugiat eget. In non purus quis elit iaculis tincidunt. Donec at ultrices est.</p>
        <p><a class="btn btn-primary pull-right" href="#">btn pull-right</a></p>
    </div>
</div><!-- /.row -->

<div class="alert">
  <h3>The Goal</h3>
  <p>Below <code>col-sm</code> breakpoint, in single-column layout, set each block of content to clear the floating button above it and add padding.</p>
  
  <h3>LESS: problem and fix</h3>
  <pre><code>// @media (max-width: @screen-sm) { // conflicts 1px with col-sm in markup
  @media (max-width: @screen-xs-max) { // fits within col-sm in markup
  [class^="col"] {
		clear: both;
		padding-bottom: 40px;
	}
  }</code></pre>

  <h3>Explanation</h3>
  <p>When using a <code>max-width: @screen-sm</code> breakpoint (768px) in my custom lines of LESS, the layout broke in iPad mini, which falls exactly at the one pixel of leeway between the class <code>screen-sm</code> on the columns and my custom lines designed to clear floating buttons and add padding for the single-column layout below the <code>@screen-sm</code> breakpoint.</p>
  <p>I fixed this by using the breakpoint <code>@screen-xs-max</code> (767px) for the breakpoint in my LESS.</p>
  <p>You can test it by exchanging the commented and uncommented media queries, and resizing the window to exactly the point where the breakpoint triggers. With the <code>@screen-sm</code> breakpoint, you'll find 1px where the columns stretch out vertically while still constrained to 1/3 width -- which is exactly what happens on the iPad mini.</p>
</div>

</div><!-- /.container -->

              
            
!

CSS

              
                // @screen-sm allows 1px of leeway, which triggers this breakpoint too soon -- affects iPad mini layout
// @screens-sm-max fixes the problem
// @media (max-width: 768px /* @screen-sm */) { // not good
@media (max-width: 767px /* @screen-xs-max */) { // works!
  [class^="col"] {
		clear: both;
		padding-bottom: 40px;
	}
}

.container, .row {
  padding-bottom: 20px;
}
pre {
  margin-top: 20px;
}
.alert {
  background-color: #9cc9f0;
}
              
            
!

JS

              
                
              
            
!
999px

Console