Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: create white glow around image

How can I create a white glow as the border of an unknown size image?

like image 644
tamir Avatar asked Jun 21 '11 09:06

tamir


People also ask

How do you make a circle glow in CSS?

You need to use a combination of the border-radius: property and the :hover pseudo class to get the desired effect. Basically, set the images border-radius to 50% - this will make your image a perfect circle.

How do I make an image light in CSS?

To set image brightness in CSS, use filter brightness(%). Remember, the value 0 makes the image black, 100% is for original image and default. Rest, you can set any value of your choice, but values above 100% would make the image brighter.


2 Answers

Use simple CSS3 (not supported in IE<9)

img {     box-shadow: 0px 0px 5px #fff; } 

This will put a white glow around every image in your document, use more specific selectors to choose which images you'd like the glow around. You can change the color of course :)

If you're worried about the users that don't have the latest versions of their browsers, use this:

img { -moz-box-shadow: 0 0 5px #fff; -webkit-box-shadow: 0 0 5px #fff; box-shadow: 0px 0px 5px #fff; } 

For IE you can use a glow filter (not sure which browsers support it)

img {     filter:progid:DXImageTransform.Microsoft.Glow(Color=white,Strength=5); } 

Play with the settings to see what suits you :)

like image 116
Kyle Avatar answered Sep 21 '22 13:09

Kyle


Works like a charm!

.imageClass {   -webkit-filter: drop-shadow(12px 12px 7px rgba(0,0,0,0.5)); } 

Voila! That's it! Obviously this won't work in ie, but who cares...

like image 26
Hank Avatar answered Sep 21 '22 13:09

Hank