• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 4. Document Layout > Using the viewBox

Using the viewBox

You saw earlier how an SVG document is similar to a bulletin board. Taking this analogy a step further, suppose you have five separate notes pinned in different locations on the bulletin board. However, rather than letting your audience see the entire bulletin board at one time, you decide they should see only one of the notes on the board. To achieve this sort of “peephole” view, the svg element uses an attribute called the viewBox.

As mentioned earlier, the top left corner of the SVG document is the (0,0) point. The viewBox honors the coordinates of a file's content but adjusts the display to match its coordinates. To do this, the viewBox has four values, each separated by a comma or a space. The first two values specify the x and y coordinates from the SVG file that will now serve as the display's (0,0) point. The final two values specify the width and height of the content (and subsequently the scale of the content).


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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