Style

Internal Stylesheets

class svgwrite.container.Style(content='', **extra)

The 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.

Style.__init__(content='', **extra)
Parameters:content (string) – stylesheet content
Style.append(content)

Append content to the existing element-content.

Best place for the style element is the defs attribute of the Drawing class:

drawing.defs.add(drawing.style('stylesheet-content'))

SVG Attributes

  • typestring

    default is 'text/css'

  • titlestring

    (For compatibility with HTML 4.) This attribute specifies an advisory title for the ‘style’ element.

  • mediastring

    This attribute specifies the intended destination medium for style information. It may be a single media descriptor or a comma-separated list. The default value for this attribute is 'all'.