HTML Course
Learn the structure of web pages.
Learn HTML from the first document to accessible forms, responsive media, validation, and a complete mini project.
HTML is the standard markup language for Web pages. With HTML you can create your own Website. HTML is easy to learn — you will enjoy it!
With our "Try it Yourself" editor, you can edit the HTML code and view the result in the browser:
What is a correct syntax for an HTML hyperlink?
HTML (HyperText Markup Language) is the standard markup language for Web pages. It defines the meaning and structure of web content — with HTML you can create your own website. CSS is normally used for presentation, while JavaScript is used for behavior.
Start with a standards-mode document, language declaration, metadata, title, and body.
Elements are written using tags. Learn opening/closing tags, nesting, and elements that don't use a closing tag.
<p>This is a paragraph.</p>
<strong>Important text</strong>
<br>
<img src="photo.jpg" alt="Example photo">
Attributes provide additional information about HTML elements. They are written inside the start tag and usually come as name="value" pairs.
name="value".<a href="https://www.APEXITI.IN.com">
Visit APEXITI.IN
</a>
The <a> tag defines a hyperlink; the href attribute specifies the URL the link goes to. Links get their own lesson later.
<img src="img_girl.jpg">
The <img> tag embeds an image; the src attribute specifies the path to that image.
src:src="https://www.APEXITI.IN.com/images/img_girl.jpg". External images may be copyrighted, and they can be removed or changed at any time.src="img_girl.jpg" (relative to the current page) or src="/images/img_girl.jpg" (relative to the domain).
<img src="img_girl.jpg"
width="500" height="600">
The width and height attributes specify the size of the image in pixels. Setting them reserves page space while the image loads.
<img src="img_typo.jpg"
alt="Girl with a jacket">

The alt attribute is required on <img>. It provides alternate text when the image cannot be shown — a slow connection, an error in src, or a user on a screen reader. (The demo above uses a broken file name on purpose, so you can see the alt text appear.)
<p style="color:red;">
This is a red paragraph.
</p>
This is a red paragraph.
The style attribute adds styles to an element — color, font, size, and more. Full styling is covered in the CSS lessons.
<html lang="en">
<body>...</body>
</html>
<html lang="en-US"> ... </html>
Always include lang inside the <html> tag to declare the page language — it assists search engines and browsers. The first two letters define the language and the last two the country.
<p title="I'm a tooltip">
This is a paragraph.
</p>
Hover over me to see the tooltip.
The title attribute defines extra information shown as a tooltip when the mouse hovers over the element.
title or TITLE, but W3C recommends (and XHTML demands) lowercase — write title.<a href="https://www.APEXITI.IN.com/html/">Visit our HTML tutorial</a><a href=https://www.APEXITI.IN.com/html/>Visit our HTML tutorial</a><p title="Description of APEXITI.IN"> breaks without them.<p title='John "ShotGun" Nelson'> — or the other way around.
| Attribute | Applies to | What it does |
|---|---|---|
href | <a> | URL of the page the link goes to |
src | <img> | Path to the image to display |
width / height | <img> | Image size in pixels |
alt | <img> | Alternate text when the image cannot be shown |
style | any element | Inline CSS — color, font, size, and more |
lang | <html> | Language of the page |
title | any element | Extra information shown as a tooltip |
class | any element | Reusable styling/selection hook |
id | any element | Unique identifier within the document |
Use headings to structure sections and paragraphs for blocks of ordinary text.
<h1>Main Page Title</h1>
<h2>Section Title</h2>
<h3>Subsection</h3>
<p>This is a paragraph of content.</p>
<hr>
<p>A second paragraph after a thematic break.</p>
<h1>, several <h2> headings, and paragraphs under each.Use elements that communicate meaning, not only visual appearance.
<strong>Important</strong>
<em>Emphasized</em>
<mark>Highlighted</mark>
<code>console.log("Hello")</code>
<kbd>Ctrl</kbd> + <kbd>S</kbd>
<small>Fine print</small>
Links connect documents and are one of the fundamental features of the Web.
<a href="https://developer.mozilla.org/">MDN Web Docs</a>
<a href="about.html">About us</a>
<a href="#contact">Jump to Contact</a>
Use <img> for images and provide meaningful alt text when the image conveys information.
<img
src="IMG/LOGO-1.PNG"
alt="Simple placeholder demonstration image"
width="500">
Use unordered, ordered, and description lists according to the meaning of the content.
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
<ol>
<li>Open editor</li>
<li>Write code</li>
<li>Run page</li>
</ol>
<dl>
<dt>HTML</dt>
<dd>Markup language for web content.</dd>
</dl>
Use tables for tabular data, not for general page layout.
<table>
<caption>Course Fees</caption>
<thead>
<tr>
<th scope="col">Course</th>
<th scope="col">Fee</th>
</tr>
</thead>
<tbody>
<tr>
<td>HTML</td>
<td>2800</td>
</tr>
</tbody>
</table>
Use meaningful structural elements when they match the content: header, nav, main, section, article, aside, and footer.
<header>Site header</header>
<nav>Main navigation</nav>
<main>
<article>
<h1>Article title</h1>
<p>Article content.</p>
</article>
<aside>Related information</aside>
</main>
<footer>Copyright information</footer>
Forms contain controls that let users enter or submit information.
<form action="/submit" method="post">
<label for="name">Name</label>
<input id="name" name="name" type="text">
<label for="email">Email</label>
<input id="email" name="email" type="email">
<button type="submit">Submit</button>
</form>
All 18 <input type="..."> values, side by side with their live browser view. Click and type in any control to experiment.
| Input Tag | Browser View |
|---|---|
<input type="text"/> | |
<input type="password"/> | |
<input type="button"/> | |
<input type="checkbox"/> | |
<input type="color"/> | #4f46e5 |
<input type="date"/> | |
<input type="time"/> | |
<input type="email"/> | |
<input type="file"/> | document.pdf |
<input type="url"/> | |
<input type="week"/> | |
<input type="number"/> | |
<input type="month"/> | |
<input type="radio"/> | |
<input type="range"/> | 70 |
<input type="reset"/> | |
<input type="search"/> | |
<input type="submit"/> |
date, time, week, and month show a native browser picker. Every row above is a real, working control — click, type, drag, and toggle to learn.Basic constraints can be expressed directly in HTML without JavaScript.
<form>
<label for="studentEmail">Email</label>
<input
id="studentEmail"
type="email"
required
minlength="6">
<label for="age">Age</label>
<input
id="age"
type="number"
min="18"
max="100"
required>
<button type="submit">Submit</button>
</form>
HTML can embed media using native elements and source controls.
<audio controls>
<source src="sound.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<video controls width="640">
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video element.
</video>
Use embedded-content elements carefully and understand their security and accessibility considerations.
<iframe
src="https://example.com"
title="Example website"
width="600"
height="300">
</iframe>
title for an iframe.Some interactive behaviors are available through native HTML elements.
<details>
<summary>Show course information</summary>
<p>HTML, CSS and JavaScript fundamentals.</p>
</details>
<dialog open>
Native dialog content
</dialog>
HTML, CSS and JavaScript fundamentals.
Dialog-style content shown for demonstration.
Global attributes can apply broadly across HTML elements.
<div id="profile" class="card" lang="en" title="Student profile">
Student information
</div>
<p hidden>This content is hidden.</p>
<div contenteditable="true">
You can edit this text.
</div>
id, class, lang, title, hidden, contenteditable, and data-*.Custom data attributes store extra information associated with an element.
<button
data-course="HTML"
data-level="beginner">
HTML Course
</button>
The <head> contains machine-readable information about the document.
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="HTML tutorial">
<title>HTML Tutorial</title>
<link rel="icon" href="favicon.ico">
</head>
Comments help document code and can temporarily hide markup from the renderer.
<!-- This is an HTML comment -->
<pre>
Preformatted text
</pre>
<code>const x = 10;</code>
Correct semantic elements, useful alternative text, good link text, proper labels, table headings, keyboard-friendly controls, and logical source order all matter.
<label for="email">Email address</label>
<input id="email" name="email" type="email">
<button type="button">Save</button>
<img src="logo-1.png" alt="Apex Institute logo">
<a href="/courses">View our courses</a>
<button> for button actions and a real <a> for navigation.Responsive image features can provide different resources for different display conditions.
<picture>
<source media="(min-width: 900px)" srcset="large.jpg">
<source media="(min-width: 600px)" srcset="medium.jpg">
<img src="small.jpg" alt="Course classroom">
</picture>
Well-structured HTML can be part of a fast-loading page. Avoid unnecessary markup and choose appropriate resource loading strategies.
<img
src="photo.jpg"
alt="Classroom"
width="800"
height="450"
loading="lazy">
<script src="app.js" defer></script>
HTML supplies structure/meaning; CSS controls presentation.
<style>
.card {
border: 1px solid #ccc;
padding: 16px;
border-radius: 10px;
}
</style>
<article class="card">
<h2>HTML Course</h2>
<p>Learn the structure of web pages.</p>
</article>
Learn the structure of web pages.
JavaScript can read and change HTML through the DOM. Keep structure and behavior conceptually separate.
<button id="helloButton">Click Me</button>
<script>
document.getElementById("helloButton")
.addEventListener("click", () => {
alert("Hello from JavaScript!");
});
</script>
Combine document structure, semantics, links, form controls, labels, validation, and a table.
Answer the questions to check the fundamentals.
Which element is normally used for the main page heading?
Which attribute provides alternative text for an image?
Which element represents a form?
Which is semantic HTML for a navigation area?
Every important tag from the classic HTML Tags Chart — tag name, code example, and its live browser view. Click, experiment, and use the search box to find a tag instantly.
<strong> over <b>, <del> over <strike>, CSS over <font>/<center>/<marquee>).
| Tag | Name | Code Example | Browser View | ||||
|---|---|---|---|---|---|---|---|
| <!--> | comment | <!-- This can be viewed in the HTML of a document --> | Nothing will show on the page — the comment is only in the source. | ||||
| <a> | anchor / hyperlink | <a href="https://example.com/">Visit Our Site</a> | Visit Our Site | ||||
| <b> | bold | <b>Example</b> | Example | ||||
| <big>use CSS | big text | <big>Example</big> | Example | ||||
| <body> | page body | <body>The content of your HTML page</body> | Everything visible on the page lives inside <body>. | ||||
| <br> | line break | The contents of your page<br>The contents of your page | The contents of your page The contents of your page | ||||
| <center>obsolete | center | <center>This will center your contents</center> | This will center your contents | ||||
| <dd> | definition description | <dd>Definition of the term</dd> |
| ||||
| <dl> | definition list | <dl><dt>Term</dt><dd>Definition</dd></dl> |
| ||||
| <dt> | definition term | <dt>Definition Term</dt> | |||||
| <em> | emphasis | This is an <em>Example</em> of emphasis | This is an Example of emphasis | ||||
| <embed> | embed object | <embed src="yourfile.mid" width="100%" height="60"> | Embeds external media (audio/video/plugins). Prefer <audio>/<video> today. | ||||
| <font>obsolete | font styling | <font face="Times New Roman" size="4" color="#ff0000">Example</font> | Example | ||||
| <form> | form | <form action="mailto:[email protected]">Name: <input size="10"></form> | |||||
| <h1–h6> | headings 1–6 | <h1>Heading 1</h1> … <h6>Heading 6</h6> | Heading 1Heading 2Heading 3Heading 4Heading 5Heading 6 | ||||
| <head> | document head | <head>Contains elements describing the document</head> | Nothing visible — holds <title>, <meta>, <link>, styles, scripts. | ||||
| <hr> | horizontal rule | <hr width="50%" size="3" noshade> | |||||
| <html> | root element | <html><body>…</body></html> | Wraps the entire document (language goes here: <html lang="en">). | ||||
| <i> | italic | <i>Example</i> | Example | ||||
| <img> | image | <img src="Earth.gif" width="41" height="41" alt="earth"> | |||||
| <input> | input field | <input type="text" size="10" maxlength="30"> | |||||
| <li> | list item | <li>List item</li> |
| ||||
| <link> | stylesheet link | <link rel="stylesheet" type="text/css" href="style.css"> | Nothing visible — connects an external stylesheet to the page. | ||||
| <marquee>obsolete | scrolling text | <marquee>Example Marquee</marquee> | |||||
| <menu>old | menu list | <menu><li>Item 1</li></menu> | |||||
| <meta> | meta info | <meta name="description" content="Description of your site"> | Nothing visible — search-engine and browser metadata (description, keywords, robots). | ||||
| <ol> | ordered list | <ol><li>Item 1</li><li>Item 2</li></ol> |
| ||||
| <option> | drop-down option | <option selected>option 2</option> | |||||
| <p> | paragraph | <p>This is a paragraph</p> | This is an example of the paragraph tag. It creates a line break and space between blocks. | ||||
| <small> | small text | <small>Example</small> | Example | ||||
| <strike>obsolete | deleted text | <strike>Example</strike> | Example | ||||
| <strong> | strong emphasis | <strong>Example</strong> | Example | ||||
| <table> | table | <table border="2" cellpadding="2">…</table> |
| ||||
| <td> | table data cell | <td>Column 1</td> | A single cell inside a <tr> — see the <table> example. | ||||
| <th> | table header | <th>Column 1</th> |
| ||||
| <title> | document title | <title>Title of your HTML page</title> | Shows in the browser tab/title bar and search results — not on the page itself. | ||||
| <tr> | table row | <tr><td>…</td></tr> | A row of cells in a table — see the <table> example. | ||||
| <tt>obsolete | teletype | <tt>Example</tt> | Example | ||||
| <u> | underline | <u>Example</u> | Example | ||||
| <ul> | unordered list | <ul><li>Item 1</li></ul> |
|
This page blocks right-click, copy, cut, select-all, drag, print, save, view-source, and developer-tool shortcuts. It also shows a tiled watermark, hides the content when the window loses focus (a deterrent against snipping tools), and intercepts the PrintScreen key where the browser allows it.
Important: a standalone HTML file cannot provide absolute DRM. Because the browser must receive the page in order to display it, a determined user can still obtain the source, the browser cache, a photograph taken with a camera, or a system-level screenshot. For genuinely protected course material, host the course on a server and deliver sensitive content through an authenticated viewer with server-side authorization, expiring sessions, and watermarking.
This course is organized around the major HTML learning areas represented in MDN's HTML documentation: fundamentals, document structure, links, lists, images, forms, guides, elements, attributes, accessibility, responsive images, media, performance, and JavaScript integration.
Mark each lesson complete as you finish it — your progress is saved in this browser.