Chapter 8. Styles and Cascading Style Sheets
In This Chapter
Styles: Inline and Embedded
External Style Sheets
CSS Properties
Throughout this book, the style attribute has been used to control various visual aspects of our SVG drawings, such as color, filters, or font size.
As an illustration, look at the code in Example 8-1.
Example 8-1.
<circle cx="10" cy="10" r="20" style="fill:red; stroke:orange; stroke-width:2"/> |
This creates a <circle> element, filled with red and outlined in orange. It also could have been written with each visual aspect coded separately as an attribute of the <circle> element:
<circle cx="50" cy="50" r="20" fill="red" stroke="orange" stroke-width="2"/>
Both render the same image. So why use the style attribute?
Get SVG for Web Developers 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.