Warning:
This wiki has been archived and is now read-only.
SVGElements/g
From HTML Wiki
<g>
The <g> element is a container element for grouping together related graphics elements.
Point
- A group of elements, as well as individual objects, can be given a name using the id attribute. Named groups are needed for several purposes such as animation and re-usable objects. [Example A]
- Grouping constructs, when used in conjunction with the <desc> and <title> elements, provide information about document structure and semantics. See also The desc element and The title element.
SVG Attributes
Examples
Example A
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="5cm" height="5cm"> <g id="group1" fill="red"> <rect x="1cm" y="1cm" width="1cm" height="1cm"/> <rect x="3cm" y="1cm" width="1cm" height="1cm"/> </g> </svg>
SVG Reference
The SVG1.1 specification defines the <g> element in 5.2.2 The g element.