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

问题描述 投票:-3回答:1

如何调整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;
}
css wordpress image resize image-resizing
1个回答
-1
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.