ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 图片自适应同步,截取方式 ``` <div class="box"> <img src="path" /> </div> .box{ img{ z-index: 1; height: 100%; width: auto; left:50%; position: relative; transform translateX(-50%) } } ``` ## IMG样式 横向拉伸,纵向自动匹配大小 ``` width:100%; height:auto; ``` 纵向拉伸,横向自动匹配大小 ``` width:auto; height:100%; ``` ## DIV样式(元素居中显示) ``` display:flex; align-items:center; justify-content:center; ```