0

I have a homepage (homepage.html) in a home app in Django. I need to extend this homepage with base.html from the root directory. I also need to include header.html (that sits in the same folder of homepage.html) along with its CSS files.

The challenge here is, since the homepage extends base.html, all css stylesheets available to the homepage.html is present in the base.html. This is because, the inclusion of header.html only happens in the body and the CSS is not available in the head section.

Is there any way to push the CSS files of header.html into the homepage so that the stylesheets are available in the head?

Looking forward

jeff
  • 910
  • 2
  • 6
  • 25
  • create a new css file – Amrit Nov 19 '18 at 11:49
  • @amrit can you elaborate. Your comment is not helpful – jeff Nov 19 '18 at 11:52
  • Do you have control over `base.html` and are you permitted to make changes to it? Perhaps an extra block in `base.html` could be added called `extra_css` which would bring in the css from any child templates - such as that from `header.html`? – Will Keeling Nov 19 '18 at 14:14
  • Possible duplicate of [How to properly extend and include in Django tempates](https://stackoverflow.com/questions/53375180/how-to-properly-extend-and-include-in-django-tempates), which you asked after this question. Please close questions that aren't relevant anymore. – dirkgroten Nov 19 '18 at 14:21

0 Answers0