How to apply opacity property of an image?

LAST READ: APR 19 2024 | Q. BY: JEET MAURIYA

R

Ramesh Verma

CSS Opacity Property

The opacity-level describes the transparency-level, it ranges from 0.0 to 1.0. The level 0.0 is completely transparent, 0.5 is 50% see-through and level 1.0 is not transparent. Opacity has a default initial value of 1 (100% opaque).


img {

    opacity: 0.5;

}


Example of Image Opacity by using CSS .class

<!DOCTYPE html>

<html>

<head> // Head section start

  <style> // internal CSS code

    .img_op { 

         opacity: 0.3;

         height: 200px;

         width; 200px;

    } 

  </style>

</head> // Head section ended


<body> // Body section start

   <img src="URL_image" class="img_op" />

</body> // Body section ended

</html>

0 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)