• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Q&A

Q1:Do I need to include a viewBox attribute on every svg element?
A1: No. The viewBox is a special attribute used when you specifically need to distort the viewport of your content. In most cases, you will never need to deal with a viewBox attribute. Keep in mind, however, that most SVG WYSIWYG editors (such as Adobe Illustrator) will export a viewBox setting that does nothing to your viewport. Unless you need to edit those settings to distort your viewport, you can just delete this attribute and its values.
Q2:When using percentages, do both width and height need to be percentage-based?
A2: No. Just as you can specify varying units for the width and height attributes (such as <rect width="50px" height="3in"/>), you can specify only one dimension as a percentage (such as <rect width="50%" height="3in"/>).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint