Click here to Skip to main content
12,360,334 members (55,105 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: CSS HTML HTML5
It is required to have shadow effect on various elements of svg like path, rect, etc.
I have tried this using filters that already given in svg , but that is not supported in all browser.
So i want it to be done using css, as i have tried this but its not woking

<html>
<head>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
 <defs>
     <style type="text/css"><![CDATA[
       rect {
           fill: red;
           stroke: blue;
           box-shadow: 6px 4px 10px 10px #888888;
           stroke-width: 3
       }
     </style>
  </defs>
  <rect x="40" y="40" rx="25" ry="50" width="150" height="100"/>
</svg>
</body>
</html>

Any suggestions will be realy appreciable,
Thanks in advance...Smile | :)
Posted 15-Jun-12 3:35am
Mac123341.1K

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

According to a thread I just read at stackOverflow (http://stackoverflow.com/questions/6088409/svg-drop-shadow-using-css3[^]) You can't do this with a box-shadow.

Looks like the (unavoidable) way to go is (a) filters or (b) non-vector images for those misbehaving browsers.

I'm still covering the whole svg and css idea, though from the little I've looked at, I'm yet to recal a css property that works for both html and svg. Take for instance the padding and margin attributes. Fine for html, no effect (chrome 19) for svg. Or take fill and stroke. Fine for svg, no effect in html.

No doubt(?), there are some properties that work for both. So far I'm tending towards the view that the syntax and use is similar for html and svg css, while the remainder of the ins and outs aren't.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 15 Jun 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100