The style Attribute

The application of style to elements is not a very complicated process, and there are a variety of ways to handle such applications. SVG offers developers four methods of applying style to elements:

  • XML presentation attributes

  • Inline CSS property declarations

  • Internal CSS style sheet references

  • External CSS style sheet references

Developers can apply style directly to objects (using the first two methods listed) or they can use a style sheet (be it internal or external). Direct application of style allows for the quickest method to test the results of style application, whereas style sheets allow for cleaner, more organized documents.

This hour will focus on the three CSS methods of applying style to SVG elements for three reasons: ...

Get Sams Teach Yourself SVG in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.