App 7: Your First Website with Flask / Build a guestbook website
Lesson 4 of 10
Static files and CSS
Put CSS, images and JavaScript in a static folder and link them with url_for. Now your site can look great.
Key points
- static/style.css
- url_for('static', filename='style.css')
- Refresh with Ctrl+Shift+R to skip the cache
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">Your turn
Add a style.css with a background colour and a nice font.
Quiz · +10 XP
Which folder holds CSS and images in Flask?
Log in to save progress and earn XP.