ในการตั้งค่าความสว่างของภาพใน CSS ให้ใช้ความสว่างของตัวกรอง (%) โปรดจำไว้ว่า ค่า 0 ทำให้รูปภาพเป็นสีดำ 100% สำหรับรูปภาพต้นฉบับและค่าเริ่มต้น พักผ่อน คุณสามารถตั้งค่าใดก็ได้ตามต้องการ แต่ค่าที่สูงกว่า 100% จะทำให้ภาพสว่างขึ้น
ตัวอย่าง
เรามาดูตัวอย่างกัน −
<!DOCTYPE html> <html> <head> <style> img.demo { filter: brightness(120%); } </style> </head> <body> <h1>Learn MySQL</h1> <img src="https://www.tutorialspoint.com/mysql/images/mysql-mini-logo.jpg" alt="MySQL" width="160" height="150"> <h1>Learn MySQL</h1> <p>Below image is brighter than the original image above.</p> <img class="demo" src="https://www.tutorialspoint.com/mysql/images/mysql-mini-logo.jpg" alt="MySQL" width="160" height="150"> </body> </html>
ผลลัพธ์