Introduction to HTML and creating your First Template(Part IX)
In this tutorial, we are going to learn what is HTML, its features, uses and how to use it to create our first Django template to be showcased on our blog web application.
This tutorial is a part of our series on Creating Blog Website using Django.
Link to the Previous tutorial:
What is HTML?
HTML also know as Hypertext Mark-Up Language; is a coding language which is interpreted by the web browsers like Google Chrome, Safari, etc.
HTML can be used to display any type of data varying from simple plain text to High Definition graphics.
Further, HTML consists of tags starting from < and ending with > which basically tells about the different types of embedded elements on the web page.
Create a Template in Django
To create a Template, create a post.html file in your blog1/template/blog1 directory. Open it in your Code editor and input the following code in it:
<html> <head> <title>First blog</title> </head> <body> <p>Hello World !</p> <p>Learning Django</p> </body> </html>
Now, run the following code :
python manage.py runserver
Open your browser at the default address; and Ta-Da the error is no longer there.
Further, you will see the text you have entered to be visible on your Web page. You can try this out with your Elements.
Here, is a list of some tags you can use to further enhance your web page.
To add the main heading :
for Sub-Headings, just replace h1 with h2 and so on.
To make the text bold :
Insert a link :
To create a Paragraph :
That’s it! Try creating your own templates using the tags mentioned above.
Further, feel free to ask any doubts in the comment section below.
Also, have a look at other posts :