# 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:
const style = parentElement.add('style')
It's possible to create it as a disconnected element with gySVG('style')
and attach it to the SVG document with .attachTo()
.
More info: mdn (opens new window) | w3c (opens new window)
# .type()
style.type( type )
Set this attribute defines type
of the style sheet language to use as a media type string.
argument:
{string} type
The media type stringreturns:
{gySVGObject}
The original object
const type = element.type();
Get the type
current value.
- returns:
{string}
# .media()
style.media( media )
Set this attribute defines to which media the style applies.
argument:
{string} media
the media stylereturns:
{gySVGObject}
The original object
const media = element.media();
Get the media
current value.