2012-01-31 40 views

回答

9

使用img標籤是不可能的,就訪問或修改它們而言,這些基本上與位圖類似。您可以將標記與其style屬性一起使用,或者也可以在文件中包含svg內聯,您可以使用html5。

+0

黨:(任何人有一個鏈接,爲什麼是這樣的情況下 – 2015-06-16 06:57:08

+1

@BradleyFlood? https://longsonr.wordpress.com/2013/10/23/restrictions-on-svg-used-as-an-image/ – 2015-06-16 07:15:50

3

差不多。如果您可以直接在HTML5文檔中使用svg標籤嵌入您的SVG,那麼你就可以用CSS樣式它,就像這樣:

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8" /> 
     <style type="text/css"> 
      #redcircle { stroke:black; stroke-width:5; } 
     </style> 
    </head> 
    <body> 
     <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"> 
      <circle id="redcircle" cx="50" cy="50" r="30" fill="red" /> 
     </svg> 
    </body> 
</html> 
+2

他要求外部svg,而不是內聯 – grm 2012-06-01 10:44:01

+2

是的,但經常很高興知道最近的替代方案。 – 2012-06-01 11:20:42

相關問題