Styling is important since it makes websites and components look nice 🙂.
In this session you’re going to learn how to style with Astro.
You’ll learn about:
- Scoped styles
- Global styles
- Using CSS
- Using Sass
- Using PostCSS
In the video, I talked about using PostCSS instead of Sass.
Well, after even more experimentation, I changed my mind again and switched back to Sass. I have reasons for this but I won’t be detailing them in this short note here.
Source Code
Here’s a link to the Github repository
Timestamp
- 0:00 Introduction
- 8:00 Recap of the last session
- 12:30 Two ways to write CSS in Astro
- 14:00 Scoped styles
- 15:45 Global styles
- 19:30 Building styles
- 21:15 Importing CSS
- 22:30 Using Sass
- 28:10 Component vs Global styles
- 31:30 Using PostCSS instead of Sass
- 38:00 PostCSS only vs PostCSS and Sass
- 44:45 Styling components
- 49:22 Screw the best practices! 🙃
- 50:00 Questions and Answers
Further Notes
You may run into frustrations if you’re styling components with JavaScript enabled. (These components have a client directive on them).
You’ll learn about client directives later in the series.
But for now, if you ran into styling issues with them, check out this article that I wrote.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the workshop or enroll in Magical Dev School.
Unlock this lesson