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

              
                <div class="box">
  <div class="box1">
  1
  </div>
  <div class="box2">
  2
  </div>
  <div class="box3">
  3
  </div>
</div>

              
            
!

CSS

              
                .box{
  display:flex;
  height:200px;
  border:1px solid #000000;
  justify-content:space-around;
/*   align-items:flex-start;  */
  /*對齊頂線*/
  
/*   align-items:flex-end;  */
  /*對齊底線*/
  
  align-items:center; 
  /*置中對齊*/
  
/*   align-items:stretch; */
  /*拉伸,在box1、box2、box3沒有設定高度時會拉到與box一樣高,為預設值*/

/*   align-items:baseline;  */
  /*對齊同一行中最大行高的中線,此範例中會對齊3*/
}

.box1 {
  font-size:24px;
  text-align:center;
  line-height:50px;
  width: 50px;
  height: 50px;
  color:white;
  background-color: rgba(200,0,0,1);
}

.box2 {
  font-size:24px;
  align-self: baseline; 
/*   對齊自己的行高基準線 */
  
/*   align-self: flex-end;  */
  /*對齊父元素底線*/
  
/*   align-self: flex-start;  */
  /*對齊父元素頂線*/

/*   align-self: center;  */
  /*對齊父元素中線*/

/*   align-self: stretch;  */
  /*拉伸,如果自己沒有設定高度會拉到與父元素一樣高*/
  text-align:center;
  line-height: 100px;
  width: 100px;
  height: 100px;
  color:white;
  background-color: rgba(0,100,0,1);
}

.box3 {
  font-size:24px;
  text-align:center;
  line-height: 150px;
  width: 150px;
  height: 150px;
  color:white;
  background-color: rgba(0,0,100,1);
}
              
            
!

JS

              
                
              
            
!
999px

Console