css27】base標籤帶有href屬性會讓chrome裡的svg元素url失效,css27chrome
一個chrome的問題,但具體原因不明。
觸發條件:chrome瀏覽器base標籤裡href屬性有值的時候
觸發問題:svg裡面的元素如果有用url的濾鏡和模糊,則會失效,在firefox裡和IE10沒有發現這個問題。
正常狀態:
有base標籤且href裡值為“.”的時候chrome裡的狀態:
測試代碼:
<!doctype html><html><head><meta charset="utf-8"><title>chrome bug</title><style>#svg{ width:500px; height:500px; display:block; margin:20px auto; background-color:#000; }</style><!--當href=""裡面有值的時候填寫的url都會失效--><base href="." target="_blank"><!--當href=""這樣則不會--><!--<base target="_blank">--></head><body><svg id="svg"><defs><lineargradient id="blur1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:#FF0000;stop-opacity:0"></stop> <stop offset="100%" style="stop-color:#FF0000;stop-opacity:1"></stop></lineargradient><filter id="Gaussian_Blur"><feGaussianBlur in="SourceGraphic" stdDeviation="3" /></filter></defs><circle cx="200" cy="50" r="40" style="stroke:url(#blur1); filter:url(#Gaussian_Blur); stroke-width:10; fill:yellow; "/><line x1="0" y1="0" x2="300" y2="300" style="stroke:url(#blur1); stroke-width:2;" /></svg></body></html>
具體原因不明,希望有大神賜教。
在svg中用js建立新元素並添加成功,卻不可以顯示(SVG開發實踐)
首先1處改成node=svgdoc.createElementNS('www.w3.org/2000/svg', 'rect');是必須的,這樣才能建立一個svgRect元素。
其次,IE8不支援svg。IE9以上在運行這個檔案的時候會屏蔽動態內容,在頁面下方會有提示,點擊允許就行了。Firefox和chrome可以直接運行這個檔案。
SVG 顯示不出中文
年輕人。你用的函數是 File SVGOutputFile 吧。
我看你的SVG映像是動態產生的。我舉一個例子你試一下就明白了
先看你的做的例子
import java.lang.Math;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class generateontology {
public static void main(String[] args) {
List list=new ArrayList();
list.add("數學");
list.add("中文");
list.add("語文");
String path="F:\\";
renderSVGGradientOnToLogy("abc",list,path);
}
public static void renderSVGGradientOnToLogy(String username,List list, String path) {
//此處為中間圓心的寫入程式碼座標,尚可修改,
int CirCenterX=500;
int CirCenterY=400;
int r=50;//圓的半徑
int length=100;//射線的長度
int LineEndX=0;
int LineEndY=0;
int CirSecEndX=0;
int CirSecEndY=0;
String NewDirectPage="SVGSecInstance.jsp";
int ListAcount=list.size();
// This is where we find out what the largest value contained in each of the array is,
// its a simple loop that goes through each value passed, and determines the highest
try{
// Get the SVG file ready for the drawing of the perfomance graph
File SVGOutputFile = new File(path,"SVGOnToLogy.svg");
// File SVGOutputFile = new File("SVGOnToLogyTest1.svg");
FileWriter SVGout = new FileWrit......餘下全文>>