Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resize first image in div

Tags:

jquery

I need to set specific width and height of image (in css), with jquery, but only for first image in one div. Is it posibble?

like image 244
SomeoneS Avatar asked Dec 10 '25 06:12

SomeoneS


1 Answers

#your_div is refers to div that contains image, may be you've something else.

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

alternative of img:first is img:eq(0).

Read about jQuery :first and :eq()

like image 53
thecodeparadox Avatar answered Dec 11 '25 20:12

thecodeparadox



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!