--- id: 587d7fa8367417b2b2512bcb title: Learn About SVG in D3 required: - src: 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js' challengeType: 6 --- ## Description
SVG stands for Scalable Vector Graphics. Here "scalable" means that, if you zoom in or out on an object, it would not appear pixelated. It scales with the display system, whether it's on a small mobile screen or a large TV monitor. SVG is used to make common geometric shapes. Since D3 maps data into a visual representation, it uses SVG to create the shapes for the visualization. SVG shapes for a web page must go within an HTML svg tag. CSS can be scalable when styles use relative units (such as vh, vw, or percentages), but using SVG is more flexible to build data visualizations.
## Instructions
Add an svg node to the body using append(). Give it a width attribute set to the provided w constant and a height attribute set to the provided h constant using the attr() method for each. You'll see it in the output because there's a background-color of pink applied to it in the style tag. Note
Width and height attributes do not have units. This is the building block of scaling - the element will always have a 5:1 width to height ratio, no matter what the zoom level is.
## Tests
```yml tests: - text: Your document should have 1 svg element. testString: assert($('svg').length == 1, 'Your document should have 1 svg element.'); - text: The svg element should have a width attribute set to 500. testString: assert($('svg').attr('width') == '500', 'The svg element should have a width attribute set to 500.'); - text: The svg element should have a height attribute set to 100. testString: assert($('svg').attr('height') == '100', 'The svg element should have a height attribute set to 100.'); ```
## Challenge Seed
```html ```
## Solution
```js // solution required ```