SVG features 1, SVG is a scalable vector graphics, in the browser to change the size of its graphics quality will not be lost. 2, compared to other bitmaps, SVG image files are smaller, more compressible. 3, SVG can be notepad and other readers, search engine access. 4, the text in the SVG image is optional, but also can be copied. 5. SVG images can interact with dom,css and JavaScript. 6, SVG can be made into a whole or local animation. Standalone SVG file
1 <svgversion= "1.1"2 Baseprofile= "full"3 width= "+"Height= "$"4 xmlns= "Http://www.w3.org/2000/svg">5 6 <rectwidth= "100%"Height= "100%"Fill= "Red" />7 8 <CircleCX= "Max"Cy= "+"R= "a"Fill= "Green" />9 Ten <textx= "Max"y= " the"font-size= "$"Text-anchor= "Middle"Fill= "White">Svg</text> One A </svg>
Note: 1. The DOCTYPE declaration from (X) HTML should be discarded because SVG-based DTD validation can cause more problems than it solves. 2.
version
And
baseProfile
attribute is required for other types of validation to determine SVG version 3, as a dialect of XML, SVG must have the correct binding namespace (in the xmlns attribute). SVG uses 1 in HTML, imports SVG as an image
<src= "Test.svg" alt= "svg">
2. Background-image introduced in CSS
Background-image:url (TEST.SVG);
3. Import SVG images using object or IFRAME
<type= "Image/svg+xml" data= "Test.svg"></ Object > < src= "Test.svg"></iframe>
4. Import SVG as data URI
<src= "Data:image/svg+xml;base64,[data]>background:url (data:image/svg+xml; Base64,[data]); <object type= "image/svg+xml" data= "data:image/svg+xml;base64,[data]></ Object>
5. Using inline SVG
<!--with version, namespace, Baseprofile -<svgversion= "1.1"Baseprofile= "full"width= "+"Height= "$"xmlns= "Http://www.w3.org/2000/svg"> <rectwidth= "100%"Height= "100%"Fill= "Green" /></svg><!--Shorthand -<svgwidth= "+"Height= "$"> <rectwidth= "100%"Height= "100%"Fill= "Green" /></svg>
Note: When you put SVG as a picture in HTML or CSS, you have no way to control this SVG through CSS.
SVG Learning Series 01-svg Introduction