<svg> <rect fill="red" height="100" id="rect" stroke="gray" stroke-width="10" width="100" x="20" y="20"></rect></svg>
<svg> <circle id="circle"cx="100" cy="80" r="50" stroke="gray" stroke-width="10" fill="red"> </svg>
circle: There are no x, y attributes because the circle center cx, cy has been set
<svg class="grid-50"> <rect fill="red" height="100" id="rect" stroke="gray" stroke-width="10" width="100" x="20" y="20"></rect></svg>
ellipse: Ellipse In fact, it is a rectangle with rounded corners
<svg > <ellipse rx=100 ry=30 cx=150 cy=60 fill="yellow" stroke="gray" /> </svg>
<svg> <line x1="0" y1="0" x2="200" y2="20" fill="gray" stroke="gray" stroke-width="2" /></svg>
Note that (0,0) cannot be used and is invalid
<svg> <polyline points="0,0 0,20 20,20 20,40 40,40" fill="white" stroke="gray" stroke-width="2" /></svg>
Of course for more complex graphics, you only need to know the coordinates of each point
<svg > <polygon points="50,50 0,100 100,100 50,50" fill="blue" stroke="gray" stroke-width="1"> </svg>
The following commands can be used for path data:
Note: All the above commands allow lowercase letters. Uppercase means absolute positioning, lowercase means relative positioning.
Must be written according to the rules
<svg> <path d="M50 50 L200 50 L200 0 L50 0 Z" fill="blue" stroke="gray" stroke-width="2" /> </svg>
demo: http://2.liteng.sinaapp.com /svg/index.html
Original address url: http://liteng.org/node/51