- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
CSS Opacity / Transparency
For CSS Opacity/ Transparency, the opacity property is used. For example,
opacity: 0.3;
Following is the code showing Opacity/ Transparency using CSS −
Example
<!DOCTYPE html> <html> <head> <style> body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } div { width: 200px; height: 200px; background-color: rgb(0, 0, 255); color: white; display: inline-block; } .transparent { background-color: rgba(0, 0, 255, 0.582); } img{ width: 200px; height: 200px; } .transparent-img{ opacity: 0.3; } </style> </head> <body> <h1>Tansparency/Opacity Example</h1> <div class="transparent"> Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic, accusantium. </div> <div> Lorem ipsum dolor sit amet consectetur adipisicing elit. Eum, nisi! </div> <hr> <img src="https://i.picsum.photos/id/487/300/300.jpg"> <img class="transparent-img" src="https://i.picsum.photos/id/487/300/300.jpg"> </body> </html>
Output
The above code will produce the following output −
- Related Articles
- CSS Transparency Using RGBA
- Perform Animation on CSS opacity
- Add transparency to the background with CSS
- With CSS add transparency to a button
- Setting Cross Browser Opacity using CSS
- Usage of -moz-opacity property with CSS
- CSS Opacity in Firefox, Safari, Chrome, Opera
- CSS Opacity that Works in All Browsers
- Set the opacity of an image with CSS
- Set the opacity for the background color with CSS
- What is transparency?
- CSS Image Opacity for All Web Browsers including IE 8 and less
- CSS3 Transparency and Gradients
- CSS3 Opacity property
- Adjusting Text background transparency in Matplotlib

Advertisements