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

              
                .centerline

h1 Problem
h2 float 1
.row.float-1
    .left left
    .center center
    .right right
br
.row.float-1
    .left left
    .center center
    .right rightreallylongtexthere

h2 flex 1
.row.flex-1
    .left left
    .center center
    .right right
br
.row.flex-1
    .left left
    .center center
    .right rightreallylongtexthere

br
br
br

h1 Solution
h2 float 2 
.row.float-2
    span.left
        span left
    span.center 
        span center
    span.right 
        span right
br
.row.float-2
    span.left
        span left
    span.center 
        span center
    span.right 
        span rightreallylongtexthere

h2 flex 2
.row.flex-2
    span.left
        span left
    span.center 
        span center
    span.right 
        span right
br
.row.flex-2
    span
        .left left
    span
        .center center
    span
        .right rightreallylongtexthere
br
br
              
            
!

CSS

              
                @mixin flexbox($d, $w, $j, $a){
    display: flex;
    flex-direction: $d;
    flex-wrap: $w;
    justify-content: $j;
    align-items: $a;
}

@mixin clearfix() {
    &:after {
        content: "";
        display: table;
        clear: both;
    }
}

.centerline{
    position: fixed;
    top: 0;
    left: 50%;
    width: 10px;
    height: 100%;
    background: red;
    transform: translateX(-50%);
    opacity: .5;
}

.row{
    position: relative;
    margin: 0 auto;
    width: 80%;
    max-width: 1400px;
    font-family: Roboto, Calibri, Arial;
    font-size: 20px;
    border: 1px solid black;
    background: rgba(black, .2);
    
    .left, .right, .center{
        background: rgba(white, .8);
    }
}

.float-1{
    @include clearfix();
    text-align: center;
        
    .left{
        float: left;
    }
    
    .right{
        float: right;
    }    
    
    .center{
        margin: 0 auto;
        display: inline-block;
        position: relative;
    }
}


.float-2{
    @include clearfix();
    text-align: center;
    
    span{
        width: (100%/3);
        &:nth-of-type(1){
            text-align: left;
        }
        &:nth-of-type(2){
            text-align: center;
        }
        &:nth-of-type(3){
            text-align: right;
        }
    }
    
    .left{
        float: left;
    }
    
    .right{
        float: right;
    }    
}

.flex-1{
    @include flexbox(row, wrap, space-between, center);
}

.flex-2{
    @include flexbox(row, wrap, flex-start, center);
    span{
        flex: 1;
        &:nth-of-type(1){
            text-align: left;
        }
        &:nth-of-type(2){
            text-align: center;
        }
        &:nth-of-type(3){
            text-align: right;
        }
    }
}

h1,
h2 {
    padding: 0 10%;
}
              
            
!

JS

              
                
              
            
!
999px

Console