Home  >  Article  >  Web Front-end  >  SVG基础|SVG SWITCH 元

SVG基础|SVG SWITCH 元

WBOY
WBOYOriginal
2016-05-17 09:07:261571browse
1.jpg

  SVG 元素是用来做什么的呢?元素也是用来绘制文字的,那么它和元素有何不同呢?switch在很多编程语言中都有这个关键字,它是分支的意思,在SVG中,可以使用元素来匹配不同的语言,在不同的浏览器语言环境中显示不同的SVG文字。

  典型的用法是用于显示不同的文字,但是你不可以用它来显示不同的图形。看下面的简单例子:

  1.   
  2.       
  3.           UK English
  4.       

  5.       
  6.           English
  7.       

  8.       
  9.           Spanish
  10.       

  11.       
  12.           中文
  13.       

  14.   

  15.      
复制代码

  如果你的浏览器是中文环境的,那么上面的代码会显示“中文”两个字,如果是英文环境的,就会看到“English”。看看下面的返回结果,你看到了什么:
2.jpg
  这个属性的浏览器兼容性如下:
  •   Chrome 1.0+
  •   Firefox (Gecko) 1.8+
  •   Internet Explorer 9.0+
  •   Opera 8.0+
  •   Safari 3.0.4+
  •   Android 3.0+
  •   Firefox Mobile (Gecko) 1.8+
  •   Safari Mobile 3.0.4+
  •   IE Mobile 不支持

  本文版权属于jQuery之家,转载请注明出处:http://www.htmleaf.com/ziliaoku/ ... g/201506112011.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn