This is a premium lesson.
Subscribe to get access to the entire course.
Sign up now We’ve gone through nearly half a dozen options for writing user interfaces. The two that we’ll be writing in this course are:
- CSS utility classes
- Web components
In summary, you’ll write CSS classes because:
- They’ll work for every web user
- They don’t require JavaScript to run
- They’re easy to write and maintain
As for web components, you’ll write them because:
- They’re a browser-native way to build custom elements
- Custom elements encapsulate complex markup and styles
- We can easily distribute these custom elements for others to use
- They’re interoperable, so consumers can use these custom elements in any web framework
Utility classes or components?
The great thing about using these two options is that they can often help bolster each other’s shortcomings. We can use utility classes to apply global styles without JavaScript, and we can use web components to encapsulate complex markup. We’ll even use a handful of our utility clas