css - 图像大小相同 - 比例缩放

标签 css wordpress image

我在调整图片大小方面遇到了麻烦。您现在看到的大小适合,但它们没有按比例缩放。如果图片太大,你知道怎么裁剪吗?

http://vintagemaedchen.de

.post-img {
	margin-bottom:20px;
}
.post-img img {
	max-width:100%;
	height:245px !important;
}

最佳答案

将图像设置为背景。

Background-size: cover;
Background-position: center;
Background-repeat: no-repeat;

关于css - 图像大小相同 - 比例缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37301266/

相关文章:

Wordpress the_excerpt 不从摘录字段返回内容

javascript - Wordpress 将菜单从悬停时打开更改为单击

php - 添加黑条以创建 16x9 图像

Android - 如何压缩或缩小图像?

java - 仅在一个目录中调用 MediaScanner (android)

javascript - 保护模板免受窃取(又名 HTTRack)

css - 为什么我似乎无法将 :visited 和::after 结合起来?

php - 将对象转换为数组

jquery - 动态突出显示列表项而不突出显示其子项

css - 无法将上边距添加到使用清除 :both 的页脚