This wiki has been archived and is now read-only.


From HTML Wiki
Jump to: navigation, search


The <defs> element is a container element for referenced elements.


  • Elements that are descendants of a 'defs' are not rendered directly. However, that the descendants of a 'defs' are always present in the source tree and thus can always be referenced by other elements. [Example A]

SVG Attributes


Example A

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
<svg width="8cm" height="3cm"
      xmlns="http://www.w3.org/2000/svg" version="1.1">
    <linearGradient id="Gradient01">
      <stop offset="20%" stop-color="#39F" />
      <stop offset="90%" stop-color="#F3F" />
  <rect x="1cm" y="1cm" width="6cm" height="1cm" 
        fill="url(#Gradient01)"  />

SVG Reference

The SVG1.1 specification defines the <defs> element in 5.3.2 The defs element.