首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

style

<style>SVG元素允许样式表来直接SVG内容内嵌入。SVG的style元素与HTML中相应的元素具有相同的属性(参见HTML <style>元素)。

用法上下文

分类

没有

允许的内容

任何元素或字符数据

属性

全局属性

  • Core attributesSpecific attributes
  • type

DOM接口

这个元素实现了SVGStyleElement接口。

例子

SVG

代码语言:javascript
复制
<svg width="100%" height="100%" viewBox="0 0 100 100"
     xmlns="http://www.w3.org/2000/svg">
  <style>
    /* <![CDATA[ */
    circle {
      fill: orange;
      stroke: black;
      stroke-width: 10px; /* Note: The value of a pixel depends
                             on the view box */
    }
    /* ]]> */
  </style>

  <circle cx="50" cy="50" r="40" />
</svg>

Result

产品规格

Specification

Status

Comment

Scalable Vector Graphics (SVG) 2The definition of '<style>' in that specification.

Candidate Recommendation

Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<style>' in that specification.

Recommendation

Initial definition

浏览器兼容性

Feature

Chrome

Edge

Firefox (Gecko)

Internet Explorer

Opera

Safari

Basic support

1.0

(Yes)

1.5 (1.8)

9.0

9.0

3.0.4

Feature

Android

Edge

Firefox Mobile (Gecko)

IE Phone

Opera Mobile

Safari Mobile

Basic support

3.0

(Yes)

1.0 (1.8)

No support

(Yes)

3.0.4

扫码关注腾讯云开发者

领取腾讯云代金券