41 lines
574 B
Text
41 lines
574 B
Text
---
|
|
title: Svg.style
|
|
---
|
|
|
|
The `Svg.style` property holds a string that will be rendered as the style
|
|
section of the SVG document.
|
|
|
|
## Signature
|
|
|
|
```js
|
|
String svg.style += 'circle {stroke:black;}'
|
|
```
|
|
|
|
Result:
|
|
|
|
```
|
|
<style type="text/css">
|
|
circle {
|
|
stroke: black;
|
|
}
|
|
</style>
|
|
```
|
|
|
|
## Notes
|
|
|
|
The style property is where plugins will add additional styling.
|
|
|
|
When adding your own styles, it's important not to
|
|
overwrite this property, but rather add your own.
|
|
|
|
In other words, do this:
|
|
|
|
```js
|
|
svg.style += myStyles
|
|
```
|
|
|
|
and don't do this:
|
|
|
|
```js
|
|
svg.style = myStyles
|
|
```
|