CONCEPT OF OPACITY IN CSS ( # tutorial 25 )

in blurtutorials •  4 years ago 

Today we will see the concept of opacity in css.
Opacity actually defines the percentage of the image that will be shown to the user on the web page.
It we set the opacity low than the image will be hardly visible and vice versa for the case opposite.

Let us take two same images to see what is the difference when we use or do not use opacity.

Final OutPut :

Screenshot from 2020-11-22 00-03-01.png

Step 1 : Create a proper html structure for your file.

Step 2 : Write following code inside the style tag.

Screenshot from 2020-11-22 00-02-46.png

Step 3 : Run the file with any of the browser to see the result.

Screenshot from 2020-11-22 00-03-01.png

Full Code :

<!doctype html>
<html>
<head>
 <meta charset="utf-8">
 <title>Inline CSS</title>
   <style>
       .image1{
           
           height: 200px;
           width: 200px;
           opacity: 0.6;
           margin-right: 35px;
       }.image2{
           height: 200px;
           width: 200px;
           opacity: 1;
       }
   
   
   </style>

 </head>
 <body>
    "<"img class="image1" src="IMAGES/image2.jpg">
     "<"img class="image2" src="IMAGES/image2.jpg">
   
 </body>

</html>


So you see the difference in the two images. one is little dim and other is dark. one has opacity set to 0.6 and one has opacity equals to 1.
opacity is between 0 and 1.

Ask Your doubts in the comments below:

Thank You.


Link For Previous Tutorials

  1. Inline CSS
  2. Internal CSS and Its Implementation
  3. External CSS
  4. ID's And Classes In CSS
  5. DIVS AND SPAN with CSS
  6. PADDING PROPERTY IN CSS #1
  7. PADDING PROPERTY IN CSS #2
  8. BOX MODEL BORDER PROPERTY IN CSS
  9. BOX MODEL BORDER PROPERTY IN CSS #2
  10. CREATE A CIRCLE USING BOX MODEL BORDER PROPERTY IN CSS #3
  11. OUTLINE BORDERS IN CSS
  12. MARGIN PROPERTY IN CSS
  13. Background Property In CSS #1
  14. CREATE BEAUTIFUL GRADIENTS
  15. Gradients #2
  16. Gradients #3
  17. Gradients #4
  18. FLOATING PROPERTY IN CSS
  19. DISPLAY PROPERTY IN CSS
  20. POSITION PROPERTY IN CSS #1
  21. POSITION PROPERTY IN CSS #2
  22. POSITION PROPERTY IN CSS #3
  23. TEXT DECORATION IN CSS
  24. Font-Family In CSS , Tutorial

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!