我正在尝试为我的 WordPress 网站设置功能图像。但是,即使所有图像具有相同的宽度。它们的高度各不相同,导致第 3 篇文章网格的下方 3 篇文章不直,因为前 3 篇文章的高度不同。有什么我可以在functions.php上写的东西可以帮助解决这个问题吗?非常感谢。
您可以使用特色(缩略图)图像作为背景图像。例如,
<style>
.post-thumbnail-img {
background-size:cover;
background-repeat: no-repeat;
background-position: center center;
height: 300px;
width:100%;}
</style>
<div class="post-thumbnail-img" style="background-image: url('<? echo the_post_thumbnail_url();?>')">
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句