HTML Basic Examples

HTML Basic Examples – Learn HTML by Practice

The best way to learn HTML is by writing and testing simple examples. In this tutorial, you will learn the most commonly used HTML elements through easy examples and outputs.

These HTML basic examples help beginners understand how HTML code works in a browser.


Example of a Simple HTML Page

<!DOCTYPE html>
<html>
<head>
    <title>HTML Basic Example</title>
</head>
<body>

<h1>My First HTML Page</h1>
<p>This page is created using HTML.</p>

</body>
</html>

Output

My First HTML Page
This page is created using HTML.

HTML Headings Example

HTML headings are used to define titles and subtitles.

<h1>Main Heading</h1>
<h2>Sub Heading</h2>
<h3>Smaller Heading</h3>

Output

Main Heading
Sub Heading
Smaller Heading

HTML Paragraph Example

Paragraphs are created using the <p> tag.

<p>This is a paragraph in HTML.</p>
<p>This is another paragraph.</p>

Output

This is a paragraph in HTML.
This is another paragraph.

HTML Line Break Example

The <br> tag breaks a line.

Hello World<br>
Welcome to HTML

Output

Hello World
Welcome to HTML

HTML Link Example

Links are created using the <a> tag.

<a href="https://phponline.in">Visit PHP Online</a>

Output

Visit PHP Online

HTML Image Example

Images are added using the <img> tag.

<img src="image.jpg" alt="Sample Image" width="200">

Output

An image with width 200px is displayed.


HTML List Example

Unordered List

<ul>
    <li>HTML</li>
    <li>CSS</li>
    <li>JavaScript</li>
</ul>

Output

• HTML
• CSS
• JavaScript

Ordered List Example

<ol>
    <li>Open Editor</li>
    <li>Write HTML</li>
    <li>Save File</li>
</ol>

Output

1. Open Editor
2. Write HTML
3. Save File

HTML Bold and Italic Example

<b>Bold Text</b><br>
<i>Italic Text</i>

Output

Bold Text
Italic Text

HTML Button Example

<button>Click Me</button>

Output

[ Click Me ]

HTML Comment Example

<!-- This is an HTML comment -->
<p>Visible content</p>

Output

Visible content

The comment is not visible in the browser.


Why Practice HTML Examples?

Practicing examples helps you:

  • Understand HTML tags faster
  • Learn by doing
  • See instant output
  • Build confidence

Common Mistakes in HTML Examples

  • Forgetting closing tags
  • Incorrect nesting of elements
  • Missing quotes in attributes
  • Saving file without .html extension

HTML basic examples, HTML examples for beginners, simple HTML examples, HTML code with output, learn HTML step by step


You make like


Frequently Asked Questions (FAQ)

1. Can I practice HTML without internet?

Yes, HTML works offline.

2. Do I need a server to run HTML?

No, HTML runs directly in a browser.

3. How many HTML tags should I learn first?

Start with basic tags like h1, p, a, img.

4. Can I build websites using only HTML?

Yes, but they will be static.

5. Is practice important in HTML?

Yes, practice is the key to learning HTML.

Related Article
Introduction to HTML

HTML Introduction – Learn the Basics of HTML HTML is the starting point of web development. Every website you see Read more

What is HTML

What Is HTML – Complete Beginner Explanation HTML is the foundation of the web. Every website you visit, from simple Read more

HTML text Editors

HTML Text Editors – Learn How to Write HTML Code To write HTML code, you need a text editor. A Read more

HTML Tags

Learn HTML Tags HTML tags are kind of like keywords that tell a web browser how to format and show Read more

HTML Elements

Elements make up an HTML file. These elements are what make web pages and tell you what content is on Read more

HTML Attributes

Attribute in HTML Attributes in HTML are special words that tell you more about an element. Attributes change the way Read more

HTML Headings

Headings in HTML The <h1> to <h6> tags are used to set up headings in HTML. <h1> shows which heading Read more

HTML Paragraphs

HTML Paragraphs A paragraph is a block of text that always starts on a new line. The HTML <p> element Read more