HTML Tags Every Beginner Should Know

HTML Tags Every Beginner Should Know

β€”

by

in

HTML (HyperText Markup Language) is the foundation of every webpage you see on the internet. It uses a set of codes called tags to structure content such as text, images, videos, and links. If you’re new to HTML, this guide will walk you through the most essential HTML tags, their types, how they work, and provide clear code examples so you can start building simple websites today.


πŸ“Œ What Are the Tags in HTML?

Tags in HTML define elements on a webpage. Each tag tells the browser how to display the content inside it. For example:

<p>This is a paragraph tag.</p>

The above code uses the <p> tag to mark a paragraph. Tags usually come in pairsβ€”an opening tag and a closing tag, except in the case of empty or void elements.

πŸ” HTML Opening and Closing Tags

Every HTML element begins with an opening tag and ends with a closing tag, which includes a forward slash (/) before the tag name.

<b>This is bold text</b>

Here, <b> is the opening tag and </b> is the end tag in HTML.

πŸ”Έ How many tags are in a regular element?
Typically, a regular HTML element has two tagsβ€”an opening and a closing tag.


πŸ”— HTML Tags Classification: Container vs. Empty Tags

There are two different types of tags:

1. Container Tags – Have both opening and closing tags.
Example:

<div>This is a container tag</div>

2. Empty Tags – Also called void elements, do not have closing tags.
Example:

<br> <!-- Breaks the line -->
<img src="image.jpg" alt="An image">

πŸ’‘ Examples of empty elements in HTML include: <br>, <hr>, <img>, <meta>, and <input>.


πŸ“ƒ HTML Tag List for Beginners

Here’s a basic HTML cheat sheet every beginner should save:

TagDescription
<html>Root of the HTML document
<head>Metadata, links, title
<title>Title of the page
<body>Main content
<h1> to <h6>Headings
<p>Paragraph
<a>Anchor (hyperlink)
<img>Image
<ul> / <ol>Unordered / Ordered list
<li>List item
<div>Division or section
<span>Inline container
<table>Table
<tr>Table row
<th>Table header
<td>Table data cell
<br>Line break
<hr>Horizontal line
<input>Form input
<form>HTML form
<button>Clickable button
<script>JavaScript code
<link>Links external files like CSS
<meta>Defines metadata

πŸ’¬ What Character Is Used to Indicate an End Tag?

A forward slash / is used to indicate an end tag in HTML.

</p> <!-- Closing a paragraph tag -->

πŸ–ΌοΈ Which HTML Tag Designates Links to Other Web Pages?

The <a> tag is used for hyperlinks.

<a href="https://example.com">Visit Example</a>

Use the href attribute to reference another value or URL.


πŸ”  Is HTML Case Sensitive?

No, HTML is not case-sensitive. <DIV> and <div> are treated the same. However, best practices and HTML5 recommend lowercase for consistency.

⚠️ Remember: While HTML5 is not case sensitive, JavaScript and CSS are.


🧱 Container Tag in HTML Example

<div class="container">
  <p>Put your HTML text here.</p>
</div>

In this example, <div> is the container tag, and it wraps other elements inside it.


πŸ”– The <code> Tag in HTML

The <code> tag is used to display programming code:

<pre><code>let x = 10;
console.log(x);</code></pre>

This will preserve the formatting and highlight it as code in the browser.


🧾 How to Use the <a> Tag Properly

To create a link to another webpage:

<a href="https://www.wikipedia.org">Go to Wikipedia</a>

You can also use it to reference internal page anchors or files.


πŸ“‚ How to Read an HTML File

If you’re wondering how to read an HTML file, you can open it in any browser by double-clicking the .html file or using a code editor like VS Code, Sublime, or Notepad++.


πŸ“„ What Element Needs to Be Added to Complete This Paragraph?

Often, you may forget to close the <p> tag. Here’s how to complete it:

<p>This is a complete paragraph.</p>

πŸ“š Common HTML Questions

Is HTML a scripting language?

No, HTML is a markup language, not a scripting language like JavaScript.

Is HTML programming language?

Technically, no. HTML structures data; it doesn’t perform logic or functions like programming languages do.

A webpage is a document that contains codes?

Yes. A webpage is a document that contains codes like HTML, CSS, and JavaScript.

What are tags in a website?

Tags define the structure and elements on a webpage. They’re used to display content, links, images, etc.

What are void elements in HTML?

Void elements are tags that don’t require a closing tag, like <br>, <hr>, or <img>

Which of the following tags defines a table header?

The <th> tag is used for table headers.

Does main content include search boxes?

Yes, if a search box is part of the core functionality of the page, it can be considered part of the main content.

Elements can contain what that defines additional property?

Attributes (like class, id, href, src) define additional properties.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *