In HTML, you can use the filter attribute to brighten the picture. You only need to add the "filter:brightness(% value)" style to the picture element. The filter attribute sets the brightness() function to adjust the brightness of the image. When the value of this function exceeds "100%", it will make the image brighter.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
In html, you can brighten images through the filter attribute. Let’s take an example to understand the implementation method:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> .img1 { -webkit-filter: brightness(50%); /* Chrome, Safari, Opera */ filter: brightness(50%); } .img2 { -webkit-filter: brightness(120%); /* Chrome, Safari, Opera */ filter: brightness(120%); } </style> </head> <body> <p>原图:</p> <img src="img/1.jpg" alt="Pineapple" width="300"> <p>filter属性控制图片的亮度:</p> <img class="img1" src="img/1.jpg" alt="Pineapple" width="300"> <img class="img2" src="img/1.jpg" alt="Pineapple" width="300"> </body> </html>
Rendering:
Description:
The filter attribute defines the visual effect of the element (for example: blur and saturation).
Thebrightness(%) function adjusts the brightness of an image, applying a linear multiplication to the image to make it look brighter or darker. If the value is 0%, the image will be completely black. If the value is 100%, there will be no change in the image. Other values correspond to linear multiplier effects. Values above 100% are okay and the image will be brighter than before. If no value is set, the default is 1.
(Learning video sharing: css video tutorial)
The above is the detailed content of How to make pictures brighter in html. For more information, please follow other related articles on the PHP Chinese website!