fayeah / blogs

方法论、问题驱动、总结
6 stars 0 forks source link

【UI】CSS垂直居中 #24

Open fayeah opened 4 years ago

fayeah commented 4 years ago

给定一个层级结构,如何实现自元素的垂直居中:

  // html
  <div class="outer">
    <div class="children-elements"></div>
  </div>

  // css
  .outer {
      height: 60px;
      width: 600px;
      background-color: yellow;
  }