# Are \<html\> tags needed in templates?

**URL:** <https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806>\
**Category:** Using Django\
**Created:** [January 9, 2020, 12:43am UTC](https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806 "2020-01-09T00:43:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jash11](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jash11/32/687_2.png) [@jash11](https://forum.djangoproject.com/u/jash11)\
**Post date:** [January 9, 2020, 12:43am UTC](https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806/1 "2020-01-09T00:43:38Z")

</div>

Do I need to include the HTML \<!DOCTYPE\> and the root tags in django templates?  
In [the tutorial](https://docs.djangoproject.com/en/3.0/intro/tutorial03/) it shows just the body’s content in the templates:

detail.html:

```auto
<h1>{{ question.question_text }}</h1>
<ul>
{% for choice in question.choice_set.all %}
    <li>{{ choice.choice_text }}</li>
{% endfor %}
</ul>

```

Is the “\<!doctype html\>” and “\<html\>\</html\>” omitted for brevity, or does django automatically add it?

---

<div class="post-metadata">

**Author:** ![takkaria](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/takkaria/32/288_2.png) [@takkaria](https://forum.djangoproject.com/u/takkaria)\
**Post date:** [January 9, 2020, 2:17am UTC](https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806/2 "2020-01-09T02:17:24Z")

</div>

You can find out yourself by going to ‘View Source’ in the browser 🙂 But no, Django doesn’t add anything automatically - only what you tell it to. So it’s omitted for brevity.

FWIW If you omit the `<!DOCTYPE html>` at the beginning an HTML file you will trigger [quirks mode](http://jkorpela.fi/quirks-mode.html) in the browser, which is a leftover from a previous age of web browsers. In a demo like this it doesn’t make a difference, but in general you don’t want that behaviour! So you should always include it in an HTML file.

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [January 13, 2020, 10:05pm UTC](https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806/3 "2020-01-13T22:05:01Z")

</div>

I’ve made a pull request to add a note to the tutorial: [https://github.com/django/django/pull/12316](https://github.com/django/django/pull/12316)

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [January 17, 2020, 4:23pm UTC](https://forum.djangoproject.com/t/are-html-tags-needed-in-templates/806/4 "2020-01-17T16:23:20Z")

</div>

This has been merged 🙂
