调整div中的第一个图像的大小

Som*_*neS 2 jquery

我需要使用jquery设置图像的特定宽度和高度(在css中),但仅适用于一个div中的第一个图像.它是posibble吗?

the*_*dox 8

#your_div 是指包含图像的div,可能是你的其他东西.

$('#your_div img:first').css({
   height: 200, // also use '200px' or something other
   width: 200  // '200px' or something other
});
Run Code Online (Sandbox Code Playgroud)

替代的img:firstimg:eq(0).

阅读jQuery :first:eq()