Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用脚本从第n个类更改图像的宽度?_Javascript_Html_Css - Fatal编程技术网

Javascript 如何使用脚本从第n个类更改图像的宽度?

Javascript 如何使用脚本从第n个类更改图像的宽度?,javascript,html,css,Javascript,Html,Css,我有几个这样的div多个类,我希望第2,第6,第7,第15和第22 div的图像是150宽 我不知道javascript,只知道html和css,但这就是我想用脚本做的。据我所知,你可以选择任何东西并改变各自的特征。谢谢 使用:n个孩子n选择器 .curbaT:nth-child1 img, .curbaT:nth-child3 img{ 宽度:150px; 高度:30px; } 你不能用这样的东西吗: <div class="curbaT"> <img sr

我有几个这样的div多个类,我希望第2,第6,第7,第15和第22 div的图像是150宽

我不知道javascript,只知道html和css,但这就是我想用脚本做的。据我所知,你可以选择任何东西并改变各自的特征。谢谢

使用:n个孩子n选择器

.curbaT:nth-child1 img, .curbaT:nth-child3 img{ 宽度:150px; 高度:30px; }
你不能用这样的东西吗:
<div class="curbaT">
        <img src="avertizare/1.png" class="img" >
        <p class="p1">Curba la stanga </p>
</div>

.img{
   left: 10px;
   height: 100px;
   width: 120px;
   margin-top: auto;
   margin-bottom: auto;
   position: absolute;
}