I'm quite a beginner in web development I've encountered some problems using Django
this is my projects modules code.
{% include 'navbar.html' %}
<h1>projects template</h1>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
specimen book. It has survived not only five centuries, but also the leap into
electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem
Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.
</p>
{% endblock content %}
and this is my navbar.html:
<h1>Logo</h1>
<hr>
when I run this, it is expected to return something like this: enter image description here
but it instead outputs this: enter image description here
as you can see it doesn't wrap the navbar text correctly. I would really appreciate it if someone helps me with this issue.
CodePudding user response:
So what you need to do is include this in your nav bar html file:
{% block content %} {% endblock %}
then add
{% extends 'navbar.html' %}
{% block content %}
<html>
...
</html>
{% endblock %}
inside your other template
CodePudding user response:
I had opened the HTML directly from my text editor by running the HTML file. so when I open it from a browser everything looks just right