<defs> required only for structuring purposes, the elements in it are not displayed, but since the gradient can only be seen when applied to a form or other element, you can define it anywhere in the document.
But you should still follow the correct syntax:
<rect style="fill:url(#myLinearGradient1)" ... />
source
share