Reputation: 1328
I've made a little SVG icon that requires a shadow on the bottom. The thing that I couldn't understand is why its shadow is cut?
Thanks in advance!
<svg xmlns="http://www.w3.org/2000/svg" class="default___3oPC0 barMiddleSVG___3x9T-" filter="" fill="url('#star_container_gradient_one')" stroke="transparent" stroke-width="0" width="43" height="36" viewBox="0 -1 43 38"><linearGradient id="star_container_gradient_one" gradientTransform="rotate(90)">
<stop offset="0" stop-color="#c2c2b3"></stop>
<stop offset="1" stop-color="#dedece"></stop>
</linearGradient>
<defs>
<style>.romb_top_border, .romb_bottom_border { fill: transparent; stroke: #e9ebd8; stroke-width: 1.5px; }</style>
<filter id="romb_container_shadow_bottom">
<feDropShadow dx="0" dy="2" stdDeviation=".5" flood-color="#4a444494"></feDropShadow>
</filter>
</defs>
<path filter="none" d="
M 1 11
L 21.4 1
L 42.8 11
L 42.8 26
L 21.4 36
L 1 26
L 1 11
Z
"></path><path class="romb_top_border" filter="none" d="
M 1 11
L 21.4 1
L 42.8 11
"></path><path class="romb_bottom_border" filter="url(#romb_container_shadow_bottom)" d="
M 42.8 26
L 21.4 36
L 1 26
"></path></svg>
Upvotes: 1
Views: 98
Reputation: 23290
Couple things. Adjust your size of the svg to accommodate the size needed for the result of the filter on the svg element and it's viewbox
, and increase the height of the filter to accommodate the boundary of the svg. Example below, hope it helps, cheers.
Oh, and PS, I assume the 8 digit hex color Mr. Longson pointed out is a remnant habit from say XAML Path habits wherein you can specify the alpha channel by appending a value to the first octet. AKA <alpha opacity>RGB
?
svg { border: rgba(255,0,0,.2) 3px solid}
<svg xmlns="http://www.w3.org/2000/svg" class="default___3oPC0 barMiddleSVG___3x9T-" filter="" fill="url('#star_container_gradient_one')" stroke="transparent" stroke-width="0" width="43" height="40" viewBox="0 0 43 38"><linearGradient id="star_container_gradient_one" gradientTransform="rotate(90)">
<stop offset="0" stop-color="#c2c2b3"></stop>
<stop offset="1" stop-color="#dedece"></stop>
</linearGradient>
<defs>
<style>.romb_top_border, .romb_bottom_border { fill: transparent; stroke: #e9ebd8; stroke-width: 1.5px; color }</style>
<filter id="romb_container_shadow_bottom" height="150%">
<feDropShadow dx="0" dy="2" stdDeviation=".5" flood-color="#4a444494"></feDropShadow>
</filter>
</defs>
<path filter="none" d="
M 1 11
L 21.4 1
L 42.8 11
L 42.8 26
L 21.4 36
L 1 26
L 1 11
Z
"></path><path class="romb_top_border" filter="none" d="
M 1 11
L 21.4 1
L 42.8 11
"></path><path class="romb_bottom_border" filter="url(#romb_container_shadow_bottom)" d="
M 42.8 26
L 21.4 36
L 1 26
"></path></svg>
Upvotes: 1