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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h2>Demo1测试inline-flex flex</h2>
<div class="demo1">
  <div class="box"></div>
  <div class="box"></div>
</div>
<span>hello</span>

<h2>Demo2 测试延展方向</h2>

<div class="demo2">
  <div class="box2">1</div>
  <div class="box2">2</div>
</div>

<h2>Demo3 wrap</h2>
<div class="demo3">
  <div class="box3">1</div>
  <div class="box3">2</div>
  <div class="box3">3</div>
</div>

<h2>Demo4 水平方向  justify-content</h2>
<div class="demo4">
  <div class="box4"></div>
  <div class="box4"></div>
  <div class="box4"></div>
</div>

<h2> Demo5 垂直方向 align-item</h2>
<div class="demo5">
  <div class="box5"></div>
  <div class="box5"></div>
  <div class="box5"></div>
</div>
              
            
!

CSS

              
                .demo1 {
  display:inline-flex;
  /*如果是display:flex 则span 变为下方*/
}
.box {
  width:200px;
  height:200px;
  border: 1px solid #000;
}

/***************************/
.demo2 {
  display: flex;
  /*到右侧且反向*/
  flex-direction: row-reverse;
  flex-direction: row;
  flex-direction: column;
  flex-direction: column-reverse;
    
}

.box2 {
   width:200px;
   height:200px;
   border: 1px solid #000;
}

.demo3 {
  width:600px;
  height: 600px;
  border: 1px solid #000;
  display: flex;
  flex-wrap: wrap;/*折行如果不够*/
  flex-wrap: nowrap;/*缩小宽度 不折行*/
  flex-wrap: wrap-reverse; /*折行 内容反着*/
}
.box3 {
   width:250px;
   height:200px;
   border: 1px solid #000;
  
}

.demo4 {
  width:600px;
  height: 600px;
  border: 1px solid #000;
  display: flex;
  justify-content:  flex-start;
  justify-content:  flex-end;
  justify-content:  center; /*水平居中*/
  justify-content:  space-around;/*头尾也会变化*/
  justify-content:  space-between;
    
}
.box4 {
   width:100px;
   height:200px;
   border: 1px solid #000;
}

.demo5 {
   width:600px;
  height: 600px;
  border: 1px solid red;
  display: flex;
  align-items: flex-start;
  align-items: flex-end;/*底部对其*/
  align-items:center;
   align-items: baseline;
   align-items: stretch;
  
}

.box5 {
   width:100px;
   height:200px;
   border: 1px solid #000;
}
              
            
!

JS

              
                
              
            
!
999px

Console