I want to be able to call classes in my main.css from all templates I have in Django. Currently, I have it stored in app_name/static/css/main.css. How do I link this to the templates so that I can simply add a class to an html element and have the class apply?
Share
I would use a base template containing all your common stuff (JQuery, main.css).
So, you will have a template called
base.htmlwill all the basic stuff and placeholders for specific pages content:Then, your actual page will be a template with something like this:
Checkout Django’s official documentation. Look for the section titled
Template Inheritance.