flex垂直居中,水平居中和其他布局方式
生活随笔
收集整理的這篇文章主要介紹了
flex垂直居中,水平居中和其他布局方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
flex水平垂直居中
<div class="content"><div class="item">1</div><div class="item">2</div><div class="item">3</div></div> .content {display: flex;align-items:center;justify-content:center;border: 1px solid #0000FF;height: 100px;width: 500px;// 下面的代碼可以讓不同寬高的圖片在固定寬高的容器里面正常比例顯示, 并且水平, 垂直居中> img {max-width: 100%;max-height: 100%;}}.item {width: 60px;height: 40px;border: 1px solid red;}參考文章: https://zhuanlan.zhihu.com/p/84289727
總結
以上是生活随笔為你收集整理的flex垂直居中,水平居中和其他布局方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言新手游戏,游戏c语言代码 - 新手
- 下一篇: 为什么重写equals()就要重写has