Learn HTML the Best Way - Free HTML Tutorials & Online Tag Guides
For beginners who want to develop their careers in web development, HTML is the first part of the journey. I recommend being passionate about your studies and delving deep into problem-solving.
Let’s learn about some important and commonly used HTML tags:
-
Document Declaration: Initially, we declare
<!DOCTYPE html>
, which specifies the document type we are using. -
Tags Structure: Note that while using tags, they have an opening tag (
<div>
) and a closing tag (</div>
). HTML tags are mostly used for SEO. -
Use of
<html>
Tag:- Document Structure: The
<html>
tag defines the beginning and end of an HTML document, encapsulating all other elements. - Namespace Declaration: It often includes the
lang
attribute to declare the language of the document, which can help with accessibility and search engine optimization (SEO). - Metadata and Content Separation: Inside the
<html>
tag, the document is typically divided into two main sections:<head>
: Contains meta-information about the document, such as its title, character set, styles, scripts, and other meta tags.<body>
: Contains the actual content of the document, including text, images, links, and other media.
- Document Structure: The
-
Other Common Tags:
- Heading Tags:
<h1>
,<h2>
,<h3>
, etc.<h1>
is the largest heading tag, while<h2>
is smaller than<h1>
, and so on. - Paragraph Tag:
<p>
is used to write content. - Horizontal Rule:
<hr />
is a self-closing tag used for creating a horizontal line. - Line Break:
<br />
is a self-closing tag used for creating line breaks. - Input Tag:
<input type="name" placeholder="Enter Your Name" required />
is also a self-closing tag. Thetype
attribute specifies the type of input (e.g., name, password, email). Theplaceholder
attribute displays a placeholder in the input box, andrequired
ensures the input cannot be left empty.
<h1>This is a Heading</h1> <h2>This is a Subheading</h2>
<p>This is a paragraph.</p>
<hr />
<br />
<input type="text" placeholder="Enter Your Name" required />
- Heading Tags:
-
Table Tags:
- Table Structure: The
<table>
tag defines a table. Inside a table, we use<tr>
for table rows,<th>
for table headers, and<td>
for table data cells. - Table Caption: The
<caption>
tag is used to add a caption to the table.
<table> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>Data 1</td> <td>Data 2</td> </tr> </table>
<table> <caption>Table Caption</caption> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>Data 1</td> <td>Data 2</td> </tr> </table>
- Table Structure: The