Introduction
In my last article, we took a quick glance at Full-Stack Development in Python. There are two major parts -- Front-End and Back-End. We started with Front-End development with HTML. We have discussed how to download the Atom Editor and how to create a basic HTML file within this editor with the basic tags and attributes. Sometimes, HTML seems pretty basic but we have to start from scratch so it is a crucial part of any web development endeavor. Here, we will cover more two features of HTML tables and Forms.
HTML Tables
Tables in HTML consist of several tags together,
<table>
- <thead>: Table head
<th>: Table coloumns
- <tr>: Table rows
Every tag has an opening, and closing tags are required. <thead> is not a compulsory section for the table structure but it will give to the user a proper idea about the columns and arrangement of the rows. Let's check the below code and example with table tags.
Example 1
In this example, we have taken three countries with name, flag, and weather details.
We have used image tags within a row and <img> tag is used with another attribute like height and width.
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <meta charset="utf-8">
- <title>This is part-2 file</title>
- </head>
- <body>
- <table border="1">
- <thead>
- <th>Countries Name</th>
- <th>Countries Flag</th>
- <th>Weather</th>
- </thead>
- <tr>
- <td>India</td>
- <td>
- <img src="255px-Flag_of_India.svg.png" width="200" height="100" alt="">
- </td>
- <td>30 Degree Celcius</td>
- </tr>
- <tr>
- <td>USA</td>
- <td>
- <img src="220px-Flag_of_the_United_States.svg.png" width="200" height="100" alt="">
- </td>
- <td>21 Degree Celcius</td>
- </tr>
- <tr>
- <td>Germany</td>
- <td>
- <img src="255px-Flag_of_Germany.svg.png" width="200" height="100" alt="" >
- </td>
- <td>24 Degree Celcius</td>
- </tr>
- </table>
- </body>
- </html>
Output
Try this code for the practice.
We can also do styling with table attributes. For a more functional site, we have to do this styling with CSS. We will discuss it soon.
Let's move on with forms.
HTML Forms
The form will be a key component of Django later on, but in order to understand how to use them with Django, we need to fully understand them with just HTML.
To make a form we will use <input> tag. Different input types are used with input tag like text, radio, checkbox, email, password, color reset, etc.
For more details please check this link here.
Example 2
Let's check this example having three different input types: Email, Password, and Submit
Here is the code for the output screen as below,
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <meta charset="utf-8">
- <title>HTML Forms</title>
- </head>
- <body>
- <form>
- <h1>Login Form</h1>
- <h2>Please fill the details:</h2>
- <input type="email" name="useremail" value="Enter Email">
- <input type="password" name="password" value="valid password Please">
- <input type="submit" name="Submit" value="Submit">
- </form>
- </body>
- </html>
Output
You can see the differences between these two images. Without a valid email format it couldn't be possible to click Submit. It will generate a pop-up message. Also there is a password in non-readable mode or we can say it is encrypted type. Submit is a button most probably so it's in Button form. In this form there are email, password and submit input types executed.
Now, we will move on with labels and actions.
The use of the label tag will allow you to add labels in front of input in your HTML form. We will also learn how to activate actions by clicking submit.
- <body>
- <form action="https://www.Google.com" method="get">
- <h1>Enter text and take me to Google</h1>
- <input type="text" name="userinput" value="">
- <input type="submit" name="Submit" value="Submit">
- </form>
- </body>
Output
We can see the redirection of these two windows in an image, where username value is "hello" and page performs the action to the mentioned link: in the form tag. This is the example of ACTION in form.


Join the conversation! Your thoughts help the community grow.