Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:07:22+00:00 2026-06-17T05:07:22+00:00

How would you get your template to use a specific css file in Flask?

  • 0

How would you get your template to use a specific css file in Flask?

admin.html = admin.css  
user.html = user.css

I’ve looked at the Flask docs and they don’t make sense?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:07:24+00:00Added an answer on June 17, 2026 at 5:07 am

    You can overwrite the <head> section in your base template in a child template. So every user page use the css file from the base.html template and only the admin.html use the other file. This is documented in http://flask.pocoo.org/docs/patterns/templateinheritance/#template-inheritance

    Edit:
    Maybe you can use this: All pages derive from base.html and use base.css. Only user.html and admin.html overwrite the head section and include base.css and the specific admin.css / user.css.

    Example :

    base.html:

         <!doctype html>
         <html>
         <head>
          {% block head %}
            <link rel="stylesheet" href="{{ url_for('static', filename='base.css') }}">
          {% endblock %}
          </head>
          <body>
          <div id="content">{% block content %}{% endblock %}</div>
    
         </body>
         </html>
    

    admin.html:

        {% extends "base.html" %}
        {% block head %}
          <link rel="stylesheet" href="{{ url_for('static', filename='base.css') }}">
          <link rel="stylesheet" href="{{ url_for('static', filename='admin.css') }}">
        {% endblock %}
        {% block content %}
         content goes here
        {% endblock %}
    

    user.html:

        {% extends "base.html" %}
        {% block head %}
          <link rel="stylesheet" href="{{ url_for('static', filename='base.css') }}">
          <link rel="stylesheet" href="{{ url_for('static', filename='user.css') }}">
        {% endblock %}
        {% block content %}
         content goes here
        {% endblock %}
    

    Edit:
    If you store your css files in a sub directory of static/ you must write the link like this:

          <link rel="stylesheet" href="{{ url_for('static', filename='css/base.css') }}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get your opinion on as how far to go with
I have one query on which I would like to get your valuable feedback.
I have come across a strange problem which I would like to get your
I have a little experience with WCF and would like to get your opinion/suggestion
I have an architecture scenario and I would like to discuss to get your
got a problem, can't get my head around this jquery and would appreciate your
In a template for a view I would like to use the name of
I'm trying to use Phil Sturgeon's CodeIgniter Template library , but I can't get
I'm trying to make use of the Perl module HTML::Template and according to the
Seeking your help to get off .epub(s) sea in iPhone world... I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.