以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  [求助]在svg中应用css,有问题请高手帮忙!  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=25411)


--  作者:zhiyu-2000
--  发布时间:12/14/2005 2:27:00 PM

--  [求助]在svg中应用css,有问题请高手帮忙!
我的svg命名为bigmotor.svg,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="bigmotorstyle.css" type="text/css"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
         "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="80">
 <title>Motor</title>
 <desc>Motor symbol as depicted in process control diagrams</desc>
 <defs>
  <linearGradient id="greyThreeD" x1="0%" x2="0%" y1="0%" y2="100%">
   <stop offset="0%" stop-color="grey"/>
   <stop offset="30%" stop-color="white"/>
   <stop offset="100%" stop-color="black"/>
  </linearGradient>
  <linearGradient id="greenThreeD" x1="0%" x2="0%" y1="0%" y2="100%">
   <stop offset="0%" stop-color="green"/>
   <stop offset="30%" stop-color="lime"/>
   <stop offset="100%" stop-color="black"/>
  </linearGradient>
  <clipPath id="cliprect">
   <rect x="0" y="10" width="120" height="60" stroke="black"
    stroke-width="2" fill="none"/>
  </clipPath>
  <symbol id="motor" viewBox="0 0 120 80" preserveAspectRatio="xMidYMid meet">
   <circle cx="60" cy="40" r="50" clip-path="url(#cliprect)"/>
   <rect x="20" y="10" width="80" height="60"/>
   <path d="M 110 40 L 114 40 M 114 42 L 114 38"/>
  </symbol>
 </defs>
 <g>
  <use xlink:href="#motor" class="on" x="0" y="0" height="80" width="120"/>
  <use xlink:href="#motor" class="off" x="120" y="0" height="80" width="120"/>
 </g>
</svg>


css命名为BigMotorStyle.css, 内容如下:

.on
{
 fill: url(bigmotor.svg#greenThreeD);
 stroke: black;
}

.off
{
 fill: url(bigmotor.svg#greyThreeD);
 stroke: black;
}

问题是在svg中根本就看不出linearGradient的效果,为什么?哪里出问题了?
这两个是放在同一目录下的。请高手赐教!


--  作者:weiwei530530
--  发布时间:12/14/2005 6:25:00 PM

--  
<stop offset="0%" stop-color="grey"/>
gray
--  作者:zhiyu-2000
--  发布时间:12/15/2005 8:24:00 AM

--  
gray 和 grey是一样的,都是RGB(128,128,128),不是这个原因!
不过还是多谢了!
--  作者:weiwei530530
--  发布时间:12/27/2005 10:27:00 AM

--  
asv还不支持跨文件 写在同一个文件就可以了
--  作者:zhiyu-2000
--  发布时间:12/27/2005 7:59:00 PM

--  
呵呵
写在同一个文件里果真可以了!多谢!
再问一句:是svg不支持还是浏览插件不支持?

--  作者:weiwei530530
--  发布时间:12/28/2005 10:21:00 AM

--  
XML/SVG是支持的
adobe svgviewer不支持
Batik支持
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
94.238ms