Stacking images with CSS Flexbox

本秂侑毒 提交于 2020-02-22 07:01:06

问题


I am learning to use CSS flexbox and I would like to render a big image on the left and two small images stacked on top of each other. How can I do this using CSS flexbox?

<div class="container">
      <img class="image1" src="#" alt="null">
      <img class="image1" src="#" alt="null">
      <img class="image3" src="#" alt="null">
</div>

回答1:


I would do this like this:

.container {
     display: flex;
}
.side {
     display: flex;
     flex-direction: column;
}
.image {
     display: block;
     margin: 5px;
}
<div class="container">
      <img class="image" src="http://placehold.it/250x250" alt="null">
      <div class="side">
          <img class="image" src="http://placehold.it/120x90" alt="null">
          <img class="image" src="http://placehold.it/120x150" alt="null">
      </div>
</div>


来源:https://stackoverflow.com/questions/38319784/stacking-images-with-css-flexbox

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!