Frontend Development

The Ultimate Comprehensive Guide for Mastering HTML

By the Domain India teamPublished 9 min read
Knowledge base article
Contents (10 sections)

HTML (HyperText Markup Language) gives every web page its structure: headings, paragraphs, links, images and forms. CSS decides how it looks and JavaScript adds behaviour, but both depend on good HTML underneath. This guide covers the HTML you need in 2026, from a correct page skeleton to semantic layout, accessible images and forms, and how to put your finished page online.

Key takeaways

Start every page with the HTML5 doctype, a lang attribute, a UTF-8 charset and a viewport meta tag. Use semantic elements (header, nav, main, article, footer) and one h1 per page, give every image meaningful alt text with width and height, and label every form field. Check your markup with the W3C validator and your browser's developer tools, then upload the finished files to your hosting's public_html folder.

1. A correct page skeleton

Every HTML page should start from this template:

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Handmade Soaps from Jaipur | Rasa Naturals</title>
  <meta name="description" content="Cold-process soaps made in small batches in Jaipur. Order online or on WhatsApp.">
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <h1>Handmade soaps from Jaipur</h1>
  <p>Small batches, natural oils, delivered across India.</p>
  <script src="js/main.js" defer></script>
</body>
</html>

What each line does:

  • The doctype line tells the browser to use modern standards mode.
  • lang="en" tells screen readers and search engines the page language. Use hi for Hindi, ta for Tamil, and so on.
  • The charset meta tag makes Indian-language text and symbols such as ₹ display correctly. Save your files as UTF-8 too.
  • The viewport meta tag makes the page fit phone screens. Without it, mobile browsers show a shrunken desktop page.
  • The title and description appear in browser tabs and search results. Write a unique pair for each page.
  • defer on the script lets the page render before the JavaScript runs.

2. Elements, tags and attributes

An element is an opening tag, its content and a closing tag, such as a paragraph. Attributes add information in the opening tag, like href on a link or alt on an image. A few elements, such as img, input, br and meta, have no content and no closing tag.

html
<p>This is a paragraph with a <a href="contact.html">link to our contact page</a>.</p>
<img src="img/soap.webp" alt="Three bars of lavender soap on a wooden tray" width="800" height="600">

3. Structure the page with semantic elements

Semantic elements say what each part of the page is. Browsers, screen readers and search engines use them to understand the page, and they replace the old habit of wrapping everything in generic divs.

html
<body>
  <header>
    <a href="index.html">Rasa Naturals</a>
    <nav aria-label="Main">
      <ul>
        <li><a href="shop.html">Shop</a></li>
        <li><a href="about.html">About</a></li>
        <li><a href="contact.html">Contact</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <article>
      <h1>How we make cold-process soap</h1>
      <section>
        <h2>Choosing the oils</h2>
        <p>…</p>
      </section>
    </article>
    <aside>
      <h2>Bestsellers</h2>
    </aside>
  </main>

  <footer>
    <p>© 2026 Rasa Naturals</p>
  </footer>
</body>
ElementUse it for
headerThe site or section header: logo, title, main navigation
navA block of main navigation links
mainThe page's unique content; use exactly one per page
articleContent that stands on its own: a blog post, a product, a news item
sectionA themed part of a page, normally with its own heading
asideRelated but secondary content, such as a sidebar
footerCopyright, contact details and secondary links

Headings form an outline. Use one h1 for the page's main topic, h2 for its sections and h3 inside those. Don't skip levels, and don't choose a heading level to make text bigger; that is CSS's job.

  • Emphasis: use strong for important text and em for stressed text. They carry meaning; b and i are only visual. Avoid u, because underlined text looks like a link.
  • Lists: ul for unordered lists, ol for steps in order, each item in an li.
  • Links: write link text that makes sense on its own ("See our shipping rates", not "click here").
html
<a href="shipping.html">See our shipping rates</a>
<a href="https://example.org/guide" target="_blank" rel="noopener">Open the guide in a new tab</a>
<a href="mailto:[email protected]">Email us</a>
<a href="tel:+919999999999">Call us</a>

Use relative URLs such as shipping.html or /shipping for pages on your own site, so links keep working if you move between test and live domains. Use target="_blank" sparingly, because visitors expect links to open in the same tab.

5. Images, video and audio

Images are usually the heaviest part of a page, so a few attributes make a big difference:

html
<img src="img/workshop.webp"
     alt="Soap maker cutting a block of soap into bars"
     width="1200" height="800"
     loading="lazy">
  • alt describes the image for screen readers and search engines. Use alt="" for purely decorative images.
  • width and height let the browser reserve space, so the page doesn't jump while images load.
  • loading="lazy" delays images below the first screen. Don't use it on the main image at the top.
  • Format: WebP or AVIF files are much smaller than JPEG or PNG at the same quality.

For video and audio, provide controls and state the file type correctly:

html
<video controls width="640" preload="metadata" poster="img/video-poster.webp">
  <source src="media/intro.mp4" type="video/mp4">
</video>

<audio controls>
  <source src="media/jingle.mp3" type="audio/mpeg">
</audio>

Note that the type for MP3 is audio/mpeg, not audio/mp3.

6. Forms that work for everyone

html
<form action="contact.php" method="post">
  <label for="name">Your name</label>
  <input id="name" name="name" type="text" autocomplete="name" required>

  <label for="email">Email</label>
  <input id="email" name="email" type="email" autocomplete="email" required>

  <label for="phone">Mobile number</label>
  <input id="phone" name="phone" type="tel" autocomplete="tel">

  <label for="message">Message</label>
  <textarea id="message" name="message" rows="5" required></textarea>

  <button type="submit">Send</button>
</form>
  • Every field needs a label linked by for and id. Placeholder text is not a label.
  • Use the right input type: email, tel, number, date and url give phone users the right keyboard and basic checks.
  • autocomplete lets browsers fill in known details.
  • Use method="post" for anything that sends personal data.
  • Browser checks are not security. required and type="email" help honest visitors; your server-side code must still check every value.

HTML alone can't send an email. The form needs a script on the server to process it. For a PHP contact form on shared hosting, see How to use PHPMailer for contact forms.

7. Accessibility and SEO basics

Good HTML does most of the work for both:

  • Use a real button for actions and a for navigation, never a clickable div; real buttons work with the keyboard.
  • Keep one h1 and a logical heading order.
  • Give every image useful alt text and every field a label.
  • Add ARIA attributes only when no HTML element does the job. The first rule of ARIA is to use native HTML where you can.
  • Write a unique title and meta description for every page. The old meta keywords tag is ignored by major search engines, so leave it out.

8. Check your work

  • W3C Nu HTML Checker at validator.w3.org finds unclosed tags, invalid attributes and duplicate IDs.
  • Browser developer tools (F12 in Chrome, Edge or Firefox) show the page structure, errors in the Console and load times in the Network tab.
  • Lighthouse, built into Chrome's developer tools, scores performance, accessibility and SEO, and explains each problem.
  • An editor: Visual Studio Code is free and has HTML autocompletion.

9. HTML inside React and other frameworks

Frameworks still produce HTML. In React, JSX looks like HTML with a few differences: class becomes className, for becomes htmlFor, every tag must be closed, including self-closing ones such as img, and inline styles are objects. The semantic and accessibility rules above apply exactly the same, because the browser only ever sees the HTML your components output.

10. Put your page online with Domain India

A static HTML site needs only web hosting and a domain. Upload your files to the public_html folder (on DirectAdmin: domains/yourdomain.com/public_html) with the File Manager or FTP, and make sure the home page is called index.html in lowercase. On DirectAdmin, index.html is served before index.php if both exist, so delete any placeholder page. The step-by-step guide is What settings do I need to upload my website.

Our cPanel, DirectAdmin and Webuzo plans include free SSL, so your site can run on https:// from the start.

DA Starter
₹100/mo + GST
  • 10 GB NVMe SSD Storage
  • 50 GB Monthly Bandwidth
  • 1 Website
  • 5 Email Accounts
See plan details
cPanel Starter
₹125/mo + GST
  • 25 GB NVMe SSD Storage
  • 50 GB Monthly Bandwidth
  • 1 Website
  • 10 Email Accounts
See plan details

Prefer not to write code at all? The AI Website Builder creates a complete site from a description of your business, with hosting included in its paid plans.

What is the minimum HTML a web page needs?

A doctype, an html element with a lang attribute, a head with a UTF-8 charset, a viewport meta tag and a title, and a body with your content. Search engines also use a meta description.

What are semantic HTML elements?

Elements that describe their content, such as header, nav, main, article, section, aside and footer. They help screen readers and search engines understand the page, unlike generic div elements.

How many h1 headings should a page have?

Use one h1 for the page's main topic, then h2 for sections and h3 inside those, without skipping levels.

Why should images have width and height attributes?

They let the browser reserve the right space before the image loads, so the page doesn't jump around. Your CSS can still make the image responsive.

Can an HTML form send email on its own?

No. The form sends its data to a URL, and a script on the server must process it and send the email. Always check the data on the server as well as in the browser.

Is the meta keywords tag still useful?

No. Major search engines ignore it. Spend the effort on a unique title, a clear meta description and well-structured headings instead.

Where do I upload my HTML files on Domain India hosting?

Into your domain's public_html folder, with the home page named index.html. On DirectAdmin the folder is domains/yourdomain.com/public_html. You can use the File Manager or an FTP client.

Ready to publish your first page? Pick a plan on DirectAdmin hosting or cPanel hosting, follow the upload guide, or try the AI Website Builder if you would rather not code.

Put your HTML site online

Upload your pages with the File Manager or FTP, with free SSL on every shared hosting plan.

See hosting plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app