Specific image extension selector in CSS or JQuery

前端 未结 3 1026
南方客
南方客 2021-01-06 01:18

I have several images in my project with several extensions (jpg, png, gif).

Is there any way to select these images according to their extensions in css or JQuery.<

3条回答
  •  醉梦人生
    2021-01-06 01:53

    You can also use CSS3 attribute selectors:

    img[src$='.png'] {
        height: 200px;
    }
    

    Browser support

    Chrome    Firefox               IE     Opera     Safari
    All       1.0 (1.7 or earlier)  7      9         3
    

提交回复
热议问题