How to create Linear in XML

In this article I have describe about example of Linear in XML
  • 1920

Read about SVG here

Create a linear in SVG

The <linearGradient> element is defining linear gradient, it is use <defs> element in gradient in SVG.

Linear is require id attributes.

Define <linearGradient> in a circle.


<?xml version="1.0" encoding="utf-8" ?>



    <svg xmlns="" version="1.1">


        <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">

          <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />

          <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />



      <rect x="50" y="20" width="150" height="150" fill="url(#grad1)" />






 SVG Linear.jpg

Define the code

  • XML define the namespace and version use the program.
  • <linearGradient> is define the linear in a rectangle.
  • stop process is define range of linear
  • <rect> is create a circle shape and style is show the color of the rectangle.
  • The <rect> element links the element to the (#grad1)

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.