style
The SVG style element allows style sheets to be embedded directly within SVG content.
SVG's style element has the same attributes as the corresponding element in HTML (see HTML's style element).
Usually, this element is created with:
js
const style = parentElement.add('style')It's possible to create it as a disconnected element with gSVG('style') and attach it to the SVG document with .attachTo().
.type()
js
style.type( type )Set this attribute defines type of the style sheet language to use as a media type string.
argument:
{string} typeThe media type stringreturns:
{gSVGObject}The original object
js
const type = element.type();Get the type current value.
- returns:
{string}
.media()
js
style.media( media )Set this attribute defines to which media the style applies.
argument:
{string} mediathe media stylereturns:
{gSVGObject}The original object
js
const media = element.media();Get the media current value.