Source: How to Scale SVG
viewBox Attributesvg element. Its value is a list of four numbers, separated by whitespace or commas: x, y, width, height. x and y set the top-left position of the coordinate system inside the svg. width and height define, among other things, the aspect ratio of the svg.svg attributes, such as fill and stroke, that can be overridden by CSS.svg term for the number of decimal places that are used to place objects (among other things) within the viewBoxxmlns is needed if you want to support non-HTML5 browsers (we probably do) or XML parsers (we probably don’t).viewBox is the key to a properly responsive SVG. While the values are often pixel-based, the values of this attribute really set the aspect ratio and provide a reference grid for the rest of the svg objects to map to.
svg will be viewable outside the viewBox.preserveAspectRatio can be set to none if you don’t want the browser to respect the aspect ratio set by the viewBox. Otherwise, the browser will try its best to not violate the aspect ratio.width and height attributes set an optional default size for the svg that can be overridden with CSS.svg is its own specification with its own style properties. Although you can style them with CSS, you need to use the proper svg properties. For example, use fill instead of background-color.width and height set?viewBox?style element, assigned as an attribute or an inline style?Take a design from yesterdays session and the following Starter Code:
img element.background-image.width, height and viewBox have on each element?svg elements can be styled with CSS!
svg that you’d like to style.fill property.stroke (and associated) property.Take the Pinball Cradle example and change the design to a new colour scheme.