css - 如何在 CSS 中自动裁剪

标签 css

我在 CSS 中有这段代码:

 <div class="col-lg-6" style="">
    <img src="images/team1.jpg" alt="portfolio img" style="margin-top: 15%; max-height: 270px; width:100%"/>
    </div>

我需要使用自动裁剪图像而不是压缩图像并变得像素化, 我试过 max-height 还是不行?有什么想法吗?

最佳答案

widthheightoverflow:hidden 设置你的 div 的样式>

div {
  width: 300px;
  height: 300px;
  overflow: hidden;
}
<div>
  <img src="http://lorempixel.com/640/650/cats" alt="portfolio img />
</div>

关于css - 如何在 CSS 中自动裁剪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38453223/

相关文章:

html - 图像在 html/css 中过于拉伸(stretch)

css - IE7图形问题

javascript - 使用响应表在表顶部进行列搜索

css - 如何垂直对齐div内的图像

html - 防止 div 重叠为堆叠的 div 格式

html - Repeat-x 不起作用 - css

html - 最小高度 :100% won't apply on a nested div

html - 移动网站右侧的空白

css - reveal.js li 元素的字体大小

javascript 未在页面上加载