Reading history

HTML Introduction: Tags, Elements and Your First Page

5 min read 1 views

Learn HTML from scratch: tags, elements and attributes, the structure of a web page, headings, links, lists, images and tables, and your first page.

HTML (HyperText Markup Language) is the language every web page is written in. It does not calculate anything; it describes what each piece of content is: a heading, a paragraph, a link, an image. Your browser reads the HTML and draws the page. This lesson gets you from an empty file to a working page in a few minutes.

In this lesson you will learn

  • What tags, elements and attributes are
  • The basic structure every HTML page needs
  • The most common elements: headings, paragraphs, links, lists, images and tables
  • How to create and open your first page
  • How HTML, CSS and JavaScript fit together

Tags, Elements and Attributes

HTML is written with tags inside angle brackets. Most come in pairs: an opening tag <p> and a closing tag </p>. Together with the content between them they form an element. Extra details go in attributes inside the opening tag, such as the address in <a href="...">.

<a href="https://coreteched.com/">Visit Core Tech ED</a>
 ^tag  ^attribute               ^content          ^closing tag

A few elements, such as <img> and <br>, have no content and no closing tag. They are called void elements.

The Structure of an HTML Page

Every page follows the same skeleton. Save this as index.html in a folder, then double-click it to open it in your browser.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My First Page</title>
</head>
<body>
  <h1>Hello from Dhaka</h1>
  <p>This is my <strong>first</strong> web page.</p>
  <a href="https://coreteched.com/">Visit Core Tech ED</a>
</body>
</html>
  • <!DOCTYPE html> tells the browser this is modern HTML5.
  • <html lang="en"> wraps everything and states the page language, which helps screen readers and search engines.
  • <head> holds information about the page: the character set, the mobile viewport setting and the <title> shown on the browser tab.
  • <body> holds everything visitors actually see.

The browser shows a large heading “Hello from Dhaka”, a paragraph with the word first in bold, and a clickable link.

Headings, Lists, Images and Tables

<h2>Today's Classes</h2>
<ul>
  <li>Maths</li>
  <li>Physics</li>
</ul>

<ol>
  <li>Open the editor</li>
  <li>Save as index.html</li>
</ol>

<img src="campus.jpg" alt="Our college campus in spring" width="400">

<table>
  <tr><th>Day</th><th>Subject</th></tr>
  <tr><td>Sunday</td><td>Chemistry</td></tr>
</table>
ElementPurpose
<h1> to <h6>Headings from most to least important. Use one <h1> per page.
<p>A paragraph of text
<a href>A link to another page or site
<ul> / <ol> with <li>Bulleted and numbered lists
<img src alt>An image; alt describes it for screen readers and when it fails to load
<table>, <tr>, <th>, <td>Tables, rows, header cells and data cells
<strong>, <em>Strong importance (bold) and emphasis (italic)
<div>, <span>Generic containers for grouping and styling

HTML, CSS and JavaScript

Web pages are built from three languages, each with one job:

  • HTML gives the page its structure and content.
  • CSS controls how it looks: colours, fonts, spacing and layout. Start with the CSS Introduction.
  • JavaScript adds behaviour: reacting to clicks, checking forms, loading new data.

Keeping them separate makes pages easier to maintain. Change the CSS file, and every page that uses it changes look at once.

Common HTML Mistakes

  1. Forgetting closing tags. An unclosed <p> or <div> can swallow the rest of the page.
  2. Wrong nesting. <b><i>text</b></i> is wrong; close tags in reverse order.
  3. Missing alt text. Blind users and search engines rely on it.
  4. Using headings for size. Pick headings by meaning, then size them with CSS.
  5. Saving as index.html.txt. Make sure your editor saves with the .html extension.

Practice Exercises

Exercise 1. Write the HTML for a link with the text “Python course” that opens https://coreteched.com/category/python/.

Show answer
<a href="/learn/python/">Python course</a>

Exercise 2. Make a numbered list of three steps for making tea.

Show answer
<ol>
  <li>Boil water</li>
  <li>Add tea leaves</li>
  <li>Add milk and sugar</li>
</ol>

Exercise 3. Which part of the page does the <title> text appear in?

Show answer

The browser tab (and search results), not the page body.

Frequently Asked Questions

Is HTML a programming language?

No. HTML is a markup language: it labels content but has no variables, loops or logic. Programming on the web is done with JavaScript.

What do I need to write HTML?

Any text editor and a web browser. VS Code is a popular free editor with helpful HTML features.

Are HTML tags case-sensitive?

No, but lowercase is the standard style and what everyone expects to read.

Summary

  • HTML describes the structure and meaning of web content using tags.
  • Every page has a doctype, <html>, <head> and <body>.
  • Headings, paragraphs, links, lists, images and tables cover most pages.
  • CSS styles the page and JavaScript adds behaviour.
Lessons are also marked complete when you click Next.

Leave a Reply

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