Home > Web Front-end > Front-end Q&A > How to make pictures brighter in html

How to make pictures brighter in html

青灯夜游
Release: 2021-06-08 15:31:56
Original
4712 people have browsed it

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.

How to make pictures brighter in html

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>
Copy after login

Rendering:

How to make pictures brighter in html

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template