📜  如何在弹性项目的中心设置文本 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:44.756000             🧑  作者: Mango

代码示例3
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

.list {
  display: flex;
  justify-content: center;
  flex-direction: column;  /* <--- I added this */
  align-items: center;   /* <--- Change here */
  height: 200px;
  width: 100%;
  background: silver;
}

.list li {  
  background: gold;
  height: 20%; 
}