Adding Shadow to SVG elements

Size
2,501 Kb
Views
12,144

How do I make an adding shadow to svg elements?

This isn't working - please leave a comment with suggestions or links to working forks of this pen.What I need to do is change color & add a shadow (glow effect) to the path element when you hover on the SVG. The filter: drop-shadow() only works when applied to the SVG itself, but in production, I intend to animate this property individually for several paths in an SVG file, so I really need to get this working on the g or path level. Thanks in advance for your help!. What is a adding shadow to svg elements? How do you make a adding shadow to svg elements? This script and codes were developed by James Steinbach on 05 November 2022, Saturday.

Adding Shadow to SVG elements Previews

Adding Shadow to SVG elements - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Adding Shadow to SVG elements</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="text">Lorem Ipsum, etc.</div>
<div class="svg-self">	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 47.6 59.8" enable-background="new 0 0 47.6 59.8"><path id="glow" fill="none" stroke-width="2" stroke-miterlimit="10" stroke="#4dbeee" d="m.8 34.7s8.7-12.4 7.5-24.3l5.2 8.9 6.1-14.4v15.9l15.4-10.4-7 16.6 16.8 1.2-19 14.5 12.7 2.2-26 14"/></svg>
</div>
<div class="svg-path">	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 64" enable-background="new 0 0 47.6 59.8"> <filter id="blur-filter" x="-2" y="-2" width="200" height="200"> <feGaussianBlur in="SourceGraphic" stdDeviation="2" /> </filter> <path id="glow" fill="none" stroke-width="2" stroke-miterlimit="10" stroke="#4dbeee" d="m.8 34.7s8.7-12.4 7.5-24.3l5.2 8.9 6.1-14.4v15.9l15.4-10.4-7 16.6 16.8 1.2-19 14.5 12.7 2.2-26 14"/> <path id="color" fill="none" stroke-width="2" stroke-miterlimit="10" stroke="#4dbeee" d="m.8 34.7s8.7-12.4 7.5-24.3l5.2 8.9 6.1-14.4v15.9l15.4-10.4-7 16.6 16.8 1.2-19 14.5 12.7 2.2-26 14"/> </svg>
</div>
</body>
</html>

Adding Shadow to SVG elements - Script Codes CSS Codes

body { background: #222; color: white;
}
div { margin: 2em; width: 10em; height: 10em; display: inline-block; vertical-align: top;
}
.text { display: block; font-size: 2em; font-family: sans-serif; height: auto;
}
.text:hover,
.svg-path svg:hover #glow { stroke: white; -webkit-filter: url(#blur-filter); filter: url(#blur-filter);
}
.svg-path svg:hover #color { stroke: white;
}
Adding Shadow to SVG elements - Script Codes
Adding Shadow to SVG elements - Script Codes
Home Page Home
Developer James Steinbach
Username jdsteinbach
Uploaded November 05, 2022
Rating 4
Size 2,501 Kb
Views 12,144
Do you need developer help for Adding Shadow to SVG elements?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

James Steinbach (jdsteinbach) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!