SVG Flashcards

1
Q

How can you create simple shapes that you then re-use in an SVG drawing?

A

use the defs element to define illustrations that are inside of g tags with IDs. Then use the ‘use’ element and reference the ID.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Draw a 2px wide white line from 0,0 to 100,100

A

line x1=”0” y1=”0” x2=”100” y2=”100” stroke=”white” stroke-width=”2”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If the viewBox is smaller than the viewport, what happens to an image?

A

It will get larger. It will be rendered into the viewbox; then the viewbox will scale up to fill the viewport.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If the viewBox is larger than the viewport, what will happen to an image?

A

It will get smaller. It will render into the viewbox; then the viewbox will scale down to fit in the viewport.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you manage how images render when viewBox and viewport aren’t the same?

A

Use preserveAspectRatio = Align takes things like “xMaxYMin”; meet/slice is like background-size contain or cover.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the viewport?

A

It’s the area where svg is visible. In concrete terms, it’s managed by width and height. E.g. svg width=”800” …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly