❰svg❱ for drawing Scalable Vector Graphics. ❰svg❱ description, syntax, usage, attributes and examples. HTML-5.com is a great guide for web developers. TV Series & Actors and Actresses. Follow TV Series and HTML 5 on Google+.
ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.
If you find this helpful, please click the Google Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)
The <svg> Tag in HTML 5
The <svg> tag can be used to draw pictures and/or text using SVG. The demo below uses two different methods to draw a sphere with a glow graident. The larger red ornament is created using a circle with a separate glow gradient. The smaller blue ornament and its glow are created with a single radial gradient in a rectangle (however, the anti-aliasing is not as good and the color with zero opacity may not be completely transparent in some browsers, which makes the drawing rectangle visible).
This is an actual working demo of the SVG example code below. (Do View Source to verify that this page is using the HTML 5 DOCTYPE. You can also verify it is Valid HTML 5 using the HTML Validator. Try using it to validate URLs with HTML examples from other places that claim to be HTML 5 web sites!)
Another way to create a glow graident on an object is shown in the <canvas> tag demo. However, that page currently causes the Firefox 3.6.12 browser to hang.
The xmlns attribute declares the namespace for all of the SVG elements. Since the xmlns attribute is inherited by child elements and descendants, it does not need to be coded on other tags in the content of the svg element, unless they are in a different namespace such as the HTML namespace.
The large red ornament is created using an SVG <circle> tag with a separate circular glow gradient. Its "ornament hanger" is created with two SVG <line> tags. The animation causes the glow gradient to appear slowly. Since the animation starts after a five second delay (begin="5s"), the style on the circle must include opacity: 0.0, which matches the from attribute on the <animate tag; otherwise the glow would suddenly disappear when the animation starts.
The smaller blue ornament is created with more minimal code. The ornament ball and its glow are created with a single radial gradient in a rectangle. Its ornament hook is actually a scaled text caret character (^). Since the animation applies to the rectangle, the whole ornament slowly appears.