Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>align-items</title>
</head>
<body>
<div class="parent">
    <div class="child">1</div>
    <div class="child">2</div>
    <div class="child">3</div>
    <div class="child">4</div>
  </div>
</body>
</html>
 
.parent {
  border: 1px solid red;
  height: 200px;
  display: flex;
  /* 项目按交叉轴起点线对齐 */
  align-items: flex-status;
  
  /* 项目按交叉轴终点线对齐 */
  /* align-items: flex-end; */
  
  /* 交叉轴方向项目中间对齐 */
  /* align-items: center; */
  
  /* 交叉轴方向按第一行文字基线对齐 */
  /* align-items:baseline; */
}
.child {
  border: 1px solid blue;
  width: 70px;
  height: 50px;
}
.child:nth-child(1){
  padding: 5px;
}
.child:nth-child(2){
  padding: 15px;
}
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers