Brightening an image using styles or Javascript

后端 未结 3 1438
Happy的楠姐
Happy的楠姐 2021-02-19 03:27

I would like to brighten an image on my webpage on mouseover using css or javascript. Ive seen some examples using opacity and filters in styles but they dont seem to work for m

3条回答
  •  悲&欢浪女
    2021-02-19 04:08

    You could use CSS sprites. Create 2 versions of the image: one normal, one bright and combine them into 1 image using Photoshop or whatever you use.

    There's a good explanation of what CSS sprites are here.

    Of course, this may not be something you could use on your site. For example, it's probably not something you'd want to use on large images (they'd double in size). You also couldn't do it this way if the images you want to brighten come from outside sources or are uploaded by users for example. It would work well for things like navigation bar images and other UI elements.

提交回复
热议问题