Software Training Institute in Chennai with 100% Placements – SLA Institute

Easy way to IT Job

Share on your Social Media

HTML Tutorial for Beginners: Code Your First Website

Published On: May 3, 2025

Since HTML is the basic foundation of all websites, knowing it is crucial for everyone working in web development. To create, maintain, and update their online presence, businesses constantly require qualified web developers with HTML expertise. Go through this HTML tutorial for beginners to learn the fundamentals. Get started on your learning journey by exploring our HTML course syllabus.

Fundamentals of HTML

Here are some key concepts for this HTML tutorial with HTML code basics and HTML beginner projects for your fundamental understanding and hands-on practice.

What is HTML?

The standard markup language for producing and organizing material on the World Wide Web is called HTML, or HyperText Markup Language.

  • Hypertext: This describes the connections between web sites. You can use HTML to make hyperlinks that, when clicked, direct you to different parts of the same page or other websites. An essential feature of the web is its interconnection.
  • Markup Language: HTML, as contrast to programming languages, employs tags to specify how web browsers should display various parts inside a document. These tags (such as “this is a heading,” “this is a paragraph,” and “this is an image”) enclose material and provide context.
  • Structure: A webpage’s structural basis is provided by HTML. It describes the various sections of the page, including the lists, headings, paragraphs, photos, videos, and forms. 

Important features of HTML:

Elements: The fundamental building components of HTML pages are called elements. Tags define them. 

Example: <p> is a paragraph element and <h1> is a heading element. 

The content of most elements is positioned between an opening tag (like <h1>) and a closing tag (like </h1>). 

Tags: Keywords included in angle brackets (< and >) are called tags. They provide instructions to the web browser on how to format and present the material. 

Attributes: Additional information about HTML elements is provided by attributes. They typically have a name and a value and are part of the opening tag. 

Example: <img src=”image.jpg” alt=”My Image”>). 

Recommended: HTML Online Course Program.

The Role of HTML in Web Development

HTML’s primary role in web development is to supply a webpage’s content and structure.

Structuring Content

Semantic Markup: HTML defines the structure and meaning of various web page elements using semantic tags. Beyond merely providing visual formatting, these tags inform the browser, as well as search engines and assistive technologies, about the nature of each piece of content.

Examples:

  • <header>: Indicates the section’s introductory information or navigational aids.
  • <nav>: A segment of navigation links is indicated.
  • <main>: Indicates the document’s main body of material.
  • <article>: Constructs a document that contains a self-contained composition (such as a blog post).
  • <section>: Organizes stuff that is relevant.
  • <footer>: Specifies the document or section’s footer.
  • <h1> to <h6>: Indicate headings with varying degrees of significance.
  • <p>: Denotes a text paragraph.
  • <ul> and <ol> with <li>: Make unordered and ordered lists using them.
  • <table>, <tr>, <th>, and <td>: Tabular data is structured using them.

Logical Organization: Developers establish a logical hierarchy and arrangement of material by appropriately utilizing these semantic tags. This facilitates both human and computer comprehension of the webpage.

Accessibility: Web accessibility depends on proper HTML structure. Semantic tags are used by screen readers and other assistive technology to interpret and communicate content to people with disabilities. 

For example: The usage of <nav> makes the navigation immediately identifiable and enables screen reader users to jump to it.

Defining Content

Textual Content: Headings, paragraphs, lists, and emphasized text (<strong>, <em>) are just a few examples of the various sorts of textual content that can be marked up and defined using HTML elements.

Multimedia Integration: HTML offers components for embedding several types of multimedia.

  • <img>: Images may be embedded using this.
  • <video>: Videos can be embedded using this.
  • <audio>: Audio can be embedded using.

Hyperlinking: The foundation of “HyperText” is the <a> (anchor) tag, which is essential for establishing hyperlinks that connect various online sites and resources.

Forms: To generate interactive forms for user input, HTML offers <<form> elements along with a variety of input types (<textarea>, <button>, <select>, <input>).

Metadata: Information about the HTML document itself is contained in the <head> section of an HTML document. This comprises:

  • <title>: The title displayed on the tab of the browser.
  • <meta> tags: Including details such as the character set, responsive viewport settings, and search engine descriptions.
  • <link> tags: Connecting to outside resources, such as favicons and CSS stylesheets.
  • <script> tags: Including JavaScript code or linking to it for interactivity.

To provide a comprehensive and captivating online experience, HTML usually collaborates with CSS for styling and visual display, and JavaScript for dynamic behavior and interactivity.

Differences Between HTML, CSS, and JavaScript

HTML, CSS, and JavaScript are the three fundamental technologies of web development, and although they complement one another well, each plays a unique and important function. Let’s explore the differences here in table:

FeatureHTMLCSSJavaScript
Primary RoleStructure and ContentStyling and PresentationBehavior and Interactivity
AnalogySkeleton, BlueprintDesign, AppearanceBrain, Nervous System, Functionality
FocusWhat the content isHow the content looksWhat the content does
Key ElementsTags, Attributes, Semantic StructureSelectors, Properties, Values, Layout ModelsVariables, Functions, Events, DOM Manipulation
Without ItPlain, unorganized contentUnstyled, basic appearanceStatic, unresponsive pages

Suggested: CSS Course in Chennai.

Environmental Setup for HTML

It’s really easy to set up an environment for HTML development, especially if you’re just starting out.

Essentials:

A Text Editor: You will write your HTML code here. First of all, you don’t need anything special. Here are a few typical choices:

Built-in Text Editors:

  • Windows: Notepad
  • macOS: TextEdit (Save files as plain text)
  • Linux: Various options like Nano, Vim, Gedit

More advanced and free code editors: These come with features like error checking, auto-completion, and syntax highlighting, which makes your code easier to read. 

Several popular options are:

  • Visual Studio Code (VS Code): A well-known and potent free editor.
  • Sublime Text: A quick and lightweight editor, a premium program with a free trial.
  • Atom: GitHub created this free and configurable editor, which is now archived but still functional.
  • Notepad++ (Windows): Notepad++ is a feature-rich and free editor for Windows.

The program you’ll use to view and test your HTML files is a web browser. Most likely, you already have a number installed:

  • Google Chrome
  • Mozilla Firefox
  • Safari (macOS)
  • Microsoft Edge

HTML Code Basics

Here is the basic HTML workflow:

Step 1: Open your text editor.

Step 2: Write your HTML code. An extremely simple HTML file can appear like this.

For example:

<!DOCTYPE html>

<html lang=”en”>

<head>

    <meta charset=”UTF-8″>

    <meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

    <title>My First Webpage</title>

</head>

<body>

    <h1>Hello, World!</h1>

    <p>This is my first HTML page.</p>

</body>

</html>

Step 3: Save File: Go to “File” > “Save As…”

  • Decide where you wish to save the file on your computer.
  • Importantly, use the .html extension when naming the file.
    • For instance, mypage.html or index.html. Your operating system and web browser are informed that this is an HTML file by the .html extension.
  • Note: To avoid saving as a.txt file, make sure the “Save as type” option is set to “All Files (*.*)” when saving in a simple text editor like Notepad. This is typically handled appropriately by default in more sophisticated code editors.

Step 4: Open your HTML file in a web browser.

  • On your PC, find the .html file you just saved.
  • Double-click the document. The content of your HTML file (“Hello, World!” and “This is my first HTML page.”) should open in your default web browser.
  • As an alternative, you can launch your browser and open your.html file by selecting “File” > “Open File…” (or a comparable option).

Reshape your skills with our web development training in Chennai.

HTML Elements and Tags

Since HTML elements and tags are the essential components of any HTML document, you are correct to concentrate on them. The key to organizing content on the web is knowing how they interact. Let’s examine their definitions and connections:

HTML Elements:

  • A section of the HTML document is represented by an HTML element. A headline, paragraph, picture, link, list, table, or any other structural element can be used.
  • Consider an element to be a container for content that determines its meaning or purpose inside the page.
  • Tags are usually used to define elements.

HTML Tags:

  • Keywords enclosed in angle brackets (< and >) are known as HTML tags. HTML elements are made with them.
  • There are opening and closing tags for the majority of HTML elements.
  • An element’s commencement is indicated by the opening tag (e.g., <h1>).
  • An element ends with the closing tag. With a forward slash before the element name (e.g., </h1>), it appears identical to the opening tag.
  • Between the opening and closing tags is the element’s content.

Example:

<h1>This is a heading</h1>

<p>This is a paragraph of text.</p>

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

  • <h1>This is a heading. There is an element </h1>. “This is a heading” is the content of the h1 element, and the opening and closing tags are <h1> and </h1>, respectively. A top-level heading is represented by this element.
  • <p>This content is a paragraph. A paragraph element is </p>. The opening tag is <p>, the closing tag is </p>, and the content is “This is a paragraph of text.”
  • A href=”https://www.example.com”> headingView an Example. An anchor element (used to create links) is </a>. “Visit Example” is the content (the text that will be shown as the link), while <a> and </a> are the opening and closing tags, respectively. The destination of the link is specified by the <a> element’s href attribute.

Recommended: Full Stack Developer Training in Chennai.

Types of HTML Elements:

  • Block-Level Elements: These elements usually occupy the entire available width (from left to right) and begin on a new line. <div>, <h1> to <h6>, <p>, <ul>, <ol>, <li>, <table>, and <form> are a few examples.
  • Inline Elements: Elements that are inline usually don’t begin on a new line and merely occupy the width required for their content. <span>, <a>, <img>, <strong>, <em>, <input>, and <button> are a few examples.

Void (Self-Closing) Elements: Because they have nothing to contain, some HTML elements lack a closing tag. These are frequently referred to as self-closing tags or vacant elements.

Examples:

  • <br> (line break)
  • <hr> (horizontal rule)
  • <img> (image)
  • <input> (form input)
  • <meta> (metadata)
  • <link> (external resource link)

While a trailing slash (such as <br />) was necessary for self-closing elements in earlier HTML specifications, it is now often optional but still valid in HTML5. Some developers choose to include it for consistency’s sake.

Attributes: HTML elements may possess attributes that offer more details about the element.

The opening tag specifies1 attributes, which typically include a name-value pair contained in single or double quotes and separated by an equals sign (=). 

  • <a href=”https://www.example.com”>…</a> (href is the attribute, “https://www.example.com” is the value)
  • <img src=”image.jpg” alt=”My Image”> (src and alt are attributes)
  • <div class=”container”>…</div> (class is an attribute)
  • <input type=”text” name=”username”> (type and name are attributes)

Review Your Skills: HTML Interview Questions and Answers.

Essential Content Elements in HTML

The essential HTML elements that are used to organize and display a webpage’s real content. The workhorses that you will utilize most often to inform your users are these. The following are some crucial HTML content elements, arranged for ease of understanding:

Textual Content

Headings (<h1> to <h6>): Headings and subheadings are defined using this. The most significant heading on the page is indicated by <h1>, while progressively less significant subheadings are indicated by following levels (<h2> to <h6>). They provide your writing hierarchy and structure.

<h1>Main Title of the Page</h1>

<h2>Section Heading</h2>

<h3>Subsection</h3>

Paragraphs (<p>): It is used to symbolize text blocks. In order to make paragraphs easier to read, browsers usually render them with some vertical spacing.

<p>This is the first paragraph of my content. It provides detailed information about the topic at hand.</p>

<p>Here’s another paragraph with more supporting details.</p>

Line Breaks (<br>): It adds a single line break to a text block. When a new paragraph is not required, use it sparingly for stylistic reasons. It is an element of emptiness.

This is a line of text.<br>

This text will appear on the next line.

Horizontal Rule (<hr>): It signifies a thematic transition between paragraph-level components. It is frequently shown as a line that is horizontal. It is an element of emptiness.

<p>This is the first section.</p>

<hr>

<p>This marks the beginning of a new section.</p>

Emphasis (<em>): It is used to highlight text, frequently italicized.

This word is <em>emphasized</em>.

Strong Importance (<strong>): It is used to denote extremely important text, usually shown in bold.

This word is <strong>very important</strong>.

Span (<span>): Inline items can be grouped and styled using this generic inline container. It doesn’t reflect anything semantic by nature.

This is <span style=”color: blue;”>some blue text</span> within a paragraph.

Lists

Unordered Lists (<ul> with <li>): It is used to make lists (typically presented with bullet points) where the order of the contents is irrelevant.

<ul>

  <li>Item 1</li>

  <li>Item 2</li>

  <li>Item 3</li>

</ul>

Ordered Lists (<ol> with <li>): It is used to make lists in which the items’ order is crucial; these lists are frequently represented by letters or numbers.

<ol>

  <li>First step</li>

  <li>Second step</li>

  <li>Third step</li>

</ol>

List Item (<li>): It denotes a single item in either an unordered (<ul>) or ordered (<ol>) list.

Images and Multimedia

Image (<img>): It is used to embed pictures into a webpage. It is a void element that needs the image source to be specified via the src attribute. For accessibility purposes and in the event that the picture does not load, the alt attribute offers substitute text.

<img src=”path/to/your/image.jpg” alt=”Description of the image”>

Video (<video>): It is used for video content embedding. It may have features like autoplay, width, height, controls, and src.

<video src=”path/to/your/video.mp4″ controls width=”320″ height=”240″>

  Your browser does not support the video tag.

</video>

Audio (<audio>): It is used for audio content embedding. It can have properties like autoplay, controls, and src, much like <video>.

<audio src=”path/to/your/audio.mp3″ controls>

  Your browser does not support the audio tag.

</audio>

Links

Anchor (<a>): Links to other web pages, files, locations within the same page, or email addresses can be created using the anchor (<a>). The destination of the link is specified by the href attribute.

<a href=”https://www.example.com”>Visit Example Website</a>

<a href=”mailto:[email protected]”>Email Us</a>

<a href=”#section2″>Jump to Section 2</a>

Tables

  • Table (<table>): For tabular data creation.
  • Table Row (<tr>): A table’s row is represented.
  • Table Heading (<th>): Specifies a table’s header cell, which is usually bold and centered.
  • Table Data (<td>): A table’s standard data cell is defined by Table Data.
  • Table Caption (<caption>): Gives the table a title or an explanation.

<table>

  <caption>Data Table</caption>

  <thead>

    <tr>

      <th>Header 1</th>

      <th>Header 2</th>

    </tr>

  </thead>

  <tbody>

    <tr>

      <td>Data 1</td>

      <td>Data 2</td>

    </tr>

    <tr>

      <td>Data 3</td>

      <td>Data 4</td>

    </tr>

  </tbody>

</table>

Forms:

  • Form (<form>): Creates an HTML form for user input.
  • Input (<input>): Represents various types of input controls (text fields, checkboxes, radio buttons, etc.).
  • Label (<label>): Provides a descriptive label for form elements, improving accessibility.
  • Button (<button>): Creates a clickable button.
  • Select (<select> with <option>): Creates a dropdown list.
  • Textarea (<textarea>): Creates a multi-line text input control.

<form action=”/submit” method=”post”>

  <label for=”name”>Name:</label>

  <input type=”text” id=”name” name=”user_name”><br><br>

  <label for=”email”>Email:</label>

  <input type=”email” id=”email” name=”user_email”><br><br>

  <button type=”submit”>Submit</button>

</form>

These are some of the most basic HTML components that you will frequently come across and utilize for organizing and displaying web information. Understanding these fundamentals is essential for creating any webpage, but as you gain more knowledge, you’ll find even more specialized components.

Enhance your skills with our WordPress training in Chennai.

HTML Beginner Projects

These HTML beginner projects, which range in difficulty, will assist them in putting the knowledge they have gained into practice.

Basic Structure and Content

  • The following concepts were covered: lists (<ul>, <ol>), links (<a>), and basic HTML structure (<h1>, <h2>, <p>, <img>).
  • A one-page web page that serves as an introduction, complete with spaces for a brief biography, a list of abilities, and links to additional profiles or social media accounts. Pure HTML without any styling.

Simple Recipe Page:

  • Topics covered include lists (ingredients and directions), headings, paragraphs, and emphasis (<strong>, <em>).
  • The title, ingredients (unordered list), and instructions (ordered list) of a beloved dish are all clearly marked on this page.

Basic Blog Layout:

  • Topics covered include headings, paragraphs, dates, and semantic HTML (<article>, <header>, <main>).
  • A straightforward blog layout consisting of a title, date, and a few content paragraphs. might have several “blog posts” on one page.

A “Coming Soon” Page:

  • Topics discussed included headings, a basic framework, and possibly a countdown with only content and no real functionality.
  • A page containing a title and a brief message stating that a website is still being built.

These projects give beginners a useful method to put their understanding of HTML to use while also developing a small portfolio of their work. As they advance, they can learn JavaScript to add interactivity and CSS to style these projects.

Explore all software training courses here.

Conclusion

This HTML tutorial for beginners has covered a lot of content. HTML is a constant requirement in web development, not just a place to start. The first, and maybe most important, step in establishing a prosperous career in the digital industry is learning its foundations. Hone your skills with our HTML training in Chennai

Share on your Social Media

Just a minute!

If you have any questions that you did not find answers for, our counsellors are here to answer them. You can get all your queries answered before deciding to join SLA and move your career forward.

We are excited to get started with you

Give us your information and we will arange for a free call (at your convenience) with one of our counsellors. You can get all your queries answered before deciding to join SLA and move your career forward.