Style and Structure
<g> – element (Group)
- Logical structure of shapes
- Styles applied to group will be inherited by children
- can associate a single <title> element with a set of shapes
- Stylistic effects : filters or masks
- Move or hide by Layer
- a way of setting css styles on an element
In the example the code is rewritten with css styling. Amount of code has increased but each style is defined.
User friendly for changes. DRY : don’t repeat yourself.
<use> – element (Reuse shapes earlier drawn or defined in defs)
<defs> – element (definition of SVG content later to use, not drawn as a child of def)
Vier keer verschillend geschreven code met hetzelfde resultaat, namelijk een stoplicht.