SVGs on the Web

This class will cover a few advanced features of vector manipulation along with how to export and use vectors on web pages. Here you will learn how to edit svgs with css and make them responsive and performant.

Prep Materials & Background Knowledge

Bring to class:

  • A mouse
  • Something you can draw on (mobile app or pen & paper)

Daily Standup

In the same groups as last class

Each person takes a turn to answer the following questions:

  1. What did you do yesterday?
  2. What will you do today?
  3. Anything blocking your progress?

Boolean Operations

These are used to manipulate paths with one another. They are essential for creating high quality designs.

Boolean operations slides

Most useful Booleans

  • Union: They will become 1 shape
  • Subtract: The top shape cuts off from the bottom shape

Union is different from grouping. Grouping doesn’t actually change any elements

SVG Optimization

SVG Slides

Instructor Led Activity: Update the Android logo Using Booleans

  • Let’s Look at our android logo and use subtract and union to reduce the paths
  • Use SVGOMG to optimize and prepare the svg for use in code
    • remove height and width when you need it to be responsive
    • Prefer viewbox
    • Prettify output

Style SVGs with CSS

style svg with css tips

CSS Tricks Essential SVG Resource

Key Takeaways

  • You have 3 options to load svgs onto a web page
  • Pick the option that makes sense for the use case
  • Inline SVGs can be edited with css and js

Expectations of working with SVGs

As a developer, you might not have to work with svgs too much. However when you do, you’ll want to nail these points:

  • Always clean up your design files by labelling, grouping, removing unnecessary paths, and running booleans when necessary
  • Always optimize your svgs so that the files are small and so they can be used inline without headaches
  • Be aware of the size of your frame
    • SVGs are scalable, but big designs create big files
  • Consider how your logo will look monochrome (1 color & transparent)

In Line SVG Demos

  • CSS Hover
  • Transitions

Today's Achievement

  • Due Wednesday January 31 2024
  • Weight: 10%
  • Create a simple svg logo in figma
  • Add your logo to a web page
  • Manipulate your logo with css