A.8 Style

Quite naturally, the style properties of an object can be represented as attributes of the corresponding element. Such attributes are called presentation attributes. For example, this rectangle has blue fill and black stroke 1 px wide:

<rect id="rect2310"
      y="350"
      x="100"
      width="300"
      height="150"
      fill="blue"
      stroke="black"
      stroke-width="1pt" />

This, however, is only one possible way to record style properties in XML. Another way is to pack all the properties into a single attribute, called style, using colons (:) to separate the name from the value in each property and semicolons (;) to separate properties:

<rect id="rect2310"
      y="350"
      x="100"
      width="300"
      height="150"
      style="fill:blue; stroke:black; stroke-width:1pt" />

Inkscape understands both methods but when writing properties to SVG, for historical reasons, only uses the second one, with a single style attribute. When both are present, the properties in the style attribute take precedence over the same properties in presentation attributes.

Once again, this appendix will not list all the style properties used by SVG (see http://w3.org/TR/SVG11/propidx.html for a complete list), but you should at least recognize them when you see them.

SVG prescribes that most (but not all) style properties should be inherited by children from their parents, provided a child does not specify its own value for that property. For example, if a rectangle has no fill property specified but its parent g has fill="blue", the rectangle will be painted blue. In Inkscape, such inheritance rarely plays a role, simply because normally, objects have most of their properties set whether you changed them or not. However, for fill and stroke properties, there’s a way to remove, or unset, these properties using the UI, making it possible to inherit these properties from the parent element (8.1.1 Paint).