Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

style

« SVG Attribute reference home

The style attribute specifies style information for its element. It functions identically to the style attribute in HTML.

Usage context

Categories Presentation attribute
Value <style>
Animatable No
Normative document SVG 1.1 (2nd Edition)
<style>
The syntax of style data depends on the style sheet language. By default, the style sheet language is CSS.

Note: In theory, the contentStyleType attribute could be used to specify styling languages other than CSS, like XSL(T). However, this was never implemented satisfactorily in browsers, so do not rely on it.

Example

The following example shows styling of a rectangle with the style attribute using CSS as style sheet language.

<svg viewbox="0 0 1000 500" xmlns="https://www.w3.org/2000/svg">
  <rect height="300" width="600" x="200" y="100" 
     style="fill: red; stroke: blue; stroke-width: 3"/>
</svg>

Elements

The following elements can use the style attribute

Document Tags and Contributors

 Contributors to this page: Tigt, Jeremie, pa7
 Last updated by: Tigt,