CSS Image Glow Transparent PNG

CSS Image Glow Transparent PNG
Code Snippet:Pure CSS PNG glow hover animation
Author: Niyaz Ahmed
Published: January 10, 2024
Last Updated: January 22, 2024
Downloads: 706
License: MIT
Edit Code online: View on CodePen
Read More

This code adds a CSS glow to a transparent PNG image on hover. The .shadowfilter class applies a drop shadow filter to the image. The transition property ensures that the glow effect animates smoothly when the user hovers over the image.

Moreover, the .shadowfilter CSS class applies the drop-shadow filter to the image. The -webkit-filter property is used to support older browsers. The -webkit-transition property is used to animate the glow effect when the image is hovered over.

How to Create Glow Effect for Transparent PNG Image Using CSS

1. First of all, create the HTML structure for your webpage. Place the image you want to apply the glow effect to within a <div> element with a unique ID, like “logo.” Make sure to include a <p> element to display a message prompting users to hover over the image.

<p>Hover the image below</p>
<div id="logo">
  <img class="shadowfilter" src="http://www.frypangraphics.com/images/logo.png" />
</div>

2. Now, let’s add the necessary CSS styles to achieve the desired image glow effect. This includes defining the main styles for the webpage and customizing the appearance of the image and its hover effect.

body {
background-color:#333
}

p {
  font-family:sans-serif;
  text-align:center;
}

#logo {
	margin:0 35% 0 35%;
	width:30%;
	height:auto;
}

#logo img {
	width:100%;
	height:auto;
}

.shadowfilter {
	-webkit-filter: drop-shadow(0px 0px 4px rgba(255,255,255,0.80));
	-webkit-transition: all 0.5s linear;
	-o-transition: all 0.5s linear;
	transition: all 0.5s linear;
	
}.shadowfilter:hover {
	-webkit-filter: drop-shadow(0px 0px 10px rgba(255, 255, 255, 0.8));
}

That’s all! hopefully, you have successfully created an image glow effect on your website. Feel free to customize the code further to suit your website’s design and enhance user interaction. If you have any questions or suggestions, comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X