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>justify-content</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;
  /* 默认值,从起点线开始顺序排列 */
  justify-content: flex-start;
  
  /* 相对终点线顺序排列 */
  /* justify-content: flex-end; */
  
  /* 居中排列 */
  /* justify-content: center; */
  
  /* 均匀分布,第一项在起点线,最后一项在终点线 */
  /* justify-content: space-between; */
  
  /* 均匀分布,每一个项目两侧有相同的留白空间,相邻项目之间的距离是两个项目之间留白的和 */
  /* justify-content: space-around; */
  
  /* 项目均匀分布,所有项目之间及项目与边框之间距离相等 */
  /* justify-content: space-evenly; */
}
.child {
  border: 1px solid blue;
  width: 70px;
  height: 50px;
}
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