

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a "black and white" image with CSS?
Following is the code to create a black and white image with CSS −
Example
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> img{ margin: 20px; } img.normal{ margin-left: 30%; width: 300px; height: 300px; } img.filter { width: 300px; height: 300px; filter: grayscale(100%); } </style> </head> <body> <h1 style="text-align: center;">CSS Black and White Image example</h1> <img class="normal" src="https://i.picsum.photos/id/59/500/500.jpg"> <img class="filter" src="https://i.picsum.photos/id/59/500/500.jpg"> </body> </html>
Output
The above code will produce the following output −
- Related Questions & Answers
- How to Create a Black and White Image Using CSS
- How to create "next" and "previous" buttons with CSS?
- How to create a "coupon" with CSS?
- How to create a "card" with CSS?
- How to create "notes" with CSS?
- How to create a "fixed" menu with CSS?
- How to create a "button group" with CSS?
- How to create a "more" button with CSS?
- How to create a responsive "timeline" with CSS?
- How to create a "section counter" with CSS?
- How to create a "sticky" navbar with CSS and JavaScript?
- How to create a "to-do list" with CSS and JavaScript?
- How to create a "coming soon page" with CSS and JavaScript?
- How to create a vertical "button group" with CSS?
- How to create a "user rating" scorecard with CSS?
Advertisements