如何在不使用css调整第一个图像大小的情况下在Wordpress页面上调整第二个图像的大小?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在不使用css调整第一个图像大小的情况下在Wordpress页面上调整第二个图像的大小?相关的知识,希望对你有一定的参考价值。

如何调整wordpress页面上的第二(或第三或第四)图像大小而不调整页面上任何其他图像的大小?我尝试过使用p:nth-​​of-type但没有成功。

.content-wrapper.with-featured-image img {
    position: relative;
    width: 600px;
    max-width: 1000px;
    height: 170px;
    max-height: 1000px;
}

.content-wrapper.with-featured-image p:nth-of-type(2) img  {
    position: relative;
    width: 600px;
    max-width: 800px;
    height: 300px;
    max-height: 400px;
}
答案

p:nth-of-type(2) img只会影响第二个<p>元素内的图像。你最好把伪类放在img元素本身上,这样它就会定位content-wrapper元素中的所有图像。

.page-id-1225 .content-wrapper.with-featured-image img:nth-of-type(2)

以上是关于如何在不使用css调整第一个图像大小的情况下在Wordpress页面上调整第二个图像的大小?的主要内容,如果未能解决你的问题,请参考以下文章