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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <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>
            
          
!
            
              .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;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console