SVG Learning Series 01-svg Introduction

Source: Internet
Author: User

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. versionAnd baseProfileattribute 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.