HTML Introduction for Beginners from Scratch

html introduction

HTML is the main content for every web page. It helps you structure text, links, and media. You can build pages that browsers convert into a well-designed page.

What is HTML?

HTML stands for HyperText Markup Language, which tells the browser how to show content. So, each web page you see on the internet has HTML.

A web page can hold many elements, such as:

  • Text
  • Links
  • Images
  • Forms

And other parts through HTML tags.

You need HTML because no page exists online without it. HTML gives order to a page. A browser reads HTML to know how to display content.

A page shows text without style or links if there is no HTML. HTML also helps you add CSS and JavaScript to the web page.

An HTML page has a root element called <html>. You have a <head> part and a <body> part inside it. The head part places the title and metadata, while the body part shows the visible page content.

Here is an example:

<!DOCTYPE html>
<html>
  <head>
    <title>My First Page</title>
  </head>
  <body>
    <h1>Hello World</h1>
    <p>This is my page.</p>
  </body>
</html>

This returns a page with a title in the browser tab and a heading with a paragraph.

An element has an opening tag, content, and a closing tag. For example <p>Hello</p> has a tag <p>, text content, and a closing </p>.

Some tags do not need a closing part, such as <br> or <img>. Tags define the role of content in the document.

How to Write Your First HTML Page

You write HTML in a plain text editor and save it as .html. Then you open that file in a browser to see the result.

Start with a <!DOCTYPE html> line, then add <html>, <head>, and <body>. Inside the body, add headings, paragraphs, and links to shape your page.

Here is an example:

<!DOCTYPE html>
<html>
  <head>
    <title>Sample Page</title>
  </head>
  <body>
    <h1>Welcome</h1>
    <p>This is a sample paragraph.</p>
    <a href="https://example.com">Visit Example</a>
  </body>
</html>

This shows a title in the tab, a main heading, a paragraph, and a link.

Attributes give extra data to elements. They sit inside the opening tag.
For example <a href="https://site.com">Link</a> has an href attribute.
It tells the browser where the link should go.

For example:

<img src="photo.jpg" alt="Profile Photo">

This loads an image and shows text if the image does not load.

You can place elements inside other elements. For example, you can put a <strong> tag inside a <p>. Browsers read elements from top to bottom in the source order. That order affects how users and screen readers view the page.

So, how do browsers read and render HTML?

A browser reads HTML code line by line. It builds a tree of nodes called the DOM. That tree tells the browser what elements exist and how they link. The browser then draws the final page on the screen.

Examples

Blog Post:

<!DOCTYPE html>
<html>
  <head>
    <title>Blog</title>
  </head>
  <body>
    <article>
      <h1>My Post</h1>
      <p>This is the start of my first blog post.</p>
    </article>
  </body>
</html>

This code shows a blog post with a title and a short text inside an article tag.

Navigation Menu:

<!DOCTYPE html>
<html>
  <head>
    <title>Menu</title>
  </head>
  <body>
    <nav>
      <a href="home.html">Home</a>
      <a href="about.html">About</a>
      <a href="contact.html">Contact</a>
    </nav>
  </body>
</html>

Navigation Menu:

<!DOCTYPE html>
<html>
  <head>
    <title>Menu</title>
  </head>
  <body>
    <nav>
      <a href="home.html">Home</a>
      <a href="about.html">About</a>
      <a href="contact.html">Contact</a>
    </nav>
  </body>
</html>

This shows three links inside a nav element. Each link points to a page.

Profile Card:

<!DOCTYPE html>
<html>
  <head>
    <title>Profile</title>
  </head>
  <body>
    <section>
      <h2>John Doe</h2>
      <img src="john.jpg" alt="John Photo">
      <p>Email: john@example.com</p>
    </section>
  </body>
</html>

This example shows a profile with a name, an image, and contact data.

Form with Input:

<!DOCTYPE html>
<html>
  <head>
    <title>Form</title>
  </head>
  <body>
    <form action="/submit" method="post">
      <label>Name:</label>
      <input type="text" name="username">
      <button type="submit">Send</button>
    </form>
  </body>
</html>

This code shows a form with a text field and a button. The form tag sends the user data to the server path defined in the action attribute.

Wrapping Up

You learned what HTML is and how it works. You also learned about elements, tags, attributes, and document flow. Here is a quick recap:

  • HTML tells the browser how to show page content.
  • A document has a head and body parts.
  • Elements and attributes give role and data.
  • Nesting and semantic tags add order and meaning.
  • Browsers read HTML into a DOM tree and then show the page.

FAQs


What is HTML Introduction for Beginners?

HTML stands for HyperText Markup Language. It builds the structure of a webpage. Every page starts with a root element <html>. Basic format looks like:
<!DOCTYPE html>
<html>
  <head>
    <title>My First Page</title>
  </head>
  <body>
    <h1>Hello World</h1>
    <p>This is my first HTML page.</p>
  </body>
</html>

How do beginners write their first HTML page?

Steps for beginners:
  1. Open a text editor like Notepad.
  2. Write code with root <html> element.
  3. Save file with extension .html.
  4. Open file in browser to view.
Example code:
<!DOCTYPE html>
<html>
  <head>
    <title>First Page</title>
  </head>
  <body>
    <p>Welcome to my HTML page.</p>
  </body>
</html>

What are common HTML tags for beginners?

Some tags every beginner must know:
  • <h1> to <h6> → Headings
  • <p> → Paragraph
  • <a> → Link
  • <img> → Image
  • <ul> and <li> → List
  • <div> → Section container
Example:
<h1>HTML Example</h1>
<p>Learning HTML tags is easy.</p>
<a href="https://example.com">Visit Site</a>

Why should beginners learn HTML first?

HTML forms the base of web pages. Without it no webpage can exist. Learning HTML gives clear control over structure. It also makes CSS and JavaScript easier later. So every web developer starts from HTML Introduction for Beginners.

Similar Reads

HTML base Tag: How to Set a Base URL for Links and Resources

Use the <base> tag in HTML to set a single base URL or target for all relative links and resources…

HTML script Tag: How to Add JavaScript to a Web Page

The script tag adds JavaScript to a web page in HTML. This lets the page run logic or load content.…

HTML ARIA Attributes for Accessibility

The HTML ARIA attributes help users with disabilities use websites. These attributes describe roles and states for tools. Understand the…

HTML dir Attribute: How to Set Text Direction

The dir attribute tells the browser which way text should go in HTML. You use it when a page or…

HTML abbr Tag: How Abbreviations Work with Examples

The abbr tag refers to an abbreviation in HTML. It helps you save space and improve accessibility. The screen readers…

HTML meter Tag: Measurements with Examples

Purpose and use cases: The HTML meter tag shows a scalar value within a known range. You can use it…

HTML Select Tag: How Combo Box & Option Work with Examples

HTML select tag and option tags let users pick values in a form. You use them to create dropdowns. The…

HTML Nav Tag: How to Create Navigation Menus

The nav tag defines a navigation block in HTML. It holds main links to other parts of your site. Search…

HTML Heading Elements: Understanding h1 to h6 with Examples

The heading elements define a content structure in HTML. Use <h1> to <h6> to show levels. <h1> means the main…

HTML bdi Tag: Control Text Direction in HTML

The HTML bdi tag marks text that has an unknown or mixed direction. It makes sure that this part does…

Previous Article

PHP array_column: How to Extract Values from Arrays

Next Article

JavaScript math.exp: How to Calculate e^x

Write a Comment

Leave a Comment

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


Subscribe to Get Updates

Get the latest updates on Coding, Database, and Algorithms straight to your inbox.
No spam. Unsubscribe anytime.