Palak Infotech Learn. Skill. Succeed.
COMPLETE HTML GUIDE

HTML Complete Notes in Hindi

Beginner से advanced level तक HTML tags, attributes, forms, tables, media और practical examples सीखें।

By Vinay Kumar Singh (MCA) · Palak Infotech Computer Institute

Examples को पढ़ें, Copy Code दबाएँ और अपने कंप्यूटर पर index.html में चलाकर अभ्यास करें।

1. HTML क्या है?

HTML का पूरा नाम HyperText Markup Language है। यह वेब पेज की संरचना (structure) बनाने के लिए इस्तेमाल होती है। HTML programming logic की जगह content को व्यवस्थित करती है। CSS से design और JavaScript से interaction जोड़ा जाता है।

याद रखें: HTML = Structure, CSS = Design, JavaScript = Behaviour / Interaction.

Web page और website

एक web page एक single document है। कई related web pages मिलकर website बनाते हैं। HTML file सामान्यतः .html extension से save होती है, जैसे index.html।

Example output

Welcome to my website

यह मेरा पहला web page है।

2. HTML Document का Basic Structure

हर नए HTML page की शुरुआत इस standard structure से करें।

index.html
<!DOCTYPE html>
<html lang="hi">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My First Web Page</title>
</head>
<body>
  <h1>Welcome to Palak Infotech</h1>
  <p>यह मेरा पहला web page है।</p>
</body>
</html>
  • <!DOCTYPE html> browser को HTML5 document बताता है।
  • <html> पूरे document का root element है।
  • <head> में title, metadata, CSS links आदि होते हैं।
  • <body> में दिखाई देने वाला मुख्य content होता है।
HTML tags को सही क्रम में बंद करें। कुछ tags जैसे <img>, <br> और <hr> void elements हैं; इनके closing tags नहीं लिखे जाते।

3. Tags, Elements और Nesting

Tag angle brackets में लिखा जाता है। आम तौर पर opening tag + content + closing tag मिलकर element बनाते हैं।

Example
<p>Hello Students</p>
<p>यह <strong>महत्वपूर्ण</strong> text है।</p>
शब्दमतलबउदाहरण
Opening tagElement शुरू करता है<p>
Contentदिखाया जाने वाला text या contentHello Students
Closing tagElement समाप्त करता है</p>
Nestingएक element के अंदर दूसरा element<strong> अंदर <p>

4. Headings, Paragraph, Line Break और Horizontal Line

<h1> से <h6> तक छह heading levels होते हैं। Heading level content की hierarchy के अनुसार चुनें, केवल size के लिए नहीं।

Headings & paragraphs
<h1>सबसे मुख्य Heading</h1>
<h2>Section Heading</h2>
<h3>Subsection Heading</h3>
<p>यह एक paragraph है।</p>
<p>पहली line<br>दूसरी line</p>
<hr>
<p>Horizontal line के बाद नया paragraph।</p>
Example output

मुख्य Heading

Section Heading

Subsection Heading

यह एक paragraph है।

पहली line
दूसरी line


Horizontal line के बाद नया paragraph।

5. Text Formatting Tags

TagउपयोगExample
<strong>महत्वपूर्ण textImportant text
<b>ध्यान खींचने के लिए boldBold text
<em>EmphasisEmphasized text
<i>अलग स्वर/technical termTechnical term
<u>Annotation underlineUnderlined
<mark>HighlightHighlighted
<small>छोटा textSmall text
<del> / <ins>हटाया / जोड़ा गया textOld New
<sub> / <sup>Subscript / SuperscriptH2O, x2
<code>Inline computer codeprint("Hello")
<pre>Whitespace सहित preformatted text
Line 1
  Line 2
<blockquote>लंबा quotation
Knowledge is power.
<q>छोटा inline quotationLearn by doing
<abbr>AbbreviationHTML
<sup>ऊपर छोटा text10th
Comments
<!-- यह comment browser में दिखाई नहीं देता -->
<p>यह दिखाई देने वाला content है।</p>

7. Images और Figure

Image के लिए <img> का उपयोग करें। Meaningful image के लिए सही alt text देना जरूरी है।

Image examples
<img src="flower.jpg" alt="लाल फूल" width="300">

<figure>
  <img src="computer.jpg" alt="Computer lab" width="320">
  <figcaption>हमारी computer lab</figcaption>
</figure>
Image का path सही रखें। Decorative image के लिए alt="" इस्तेमाल किया जा सकता है; meaningful image का वर्णन करें।

8. Lists (सूचियाँ)

Ordered List

क्रम 1, 2, 3 में सूची।

HTML
<ol>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ol>
  1. HTML
  2. CSS
  3. JavaScript

Unordered List

Bullet points में सूची।

HTML
<ul>
  <li>Keyboard</li>
  <li>Mouse</li>
  <li>Monitor</li>
</ul>
  • Keyboard
  • Mouse
  • Monitor

Description List

HTML
<dl>
  <dt>HTML</dt>
  <dd>Web page की structure language.</dd>
  <dt>CSS</dt>
  <dd>Web page की styling language.</dd>
</dl>

9. Tables (तालिका)

Table में rows के लिए <tr>, header cells के लिए <th> और data cells के लिए <td> इस्तेमाल होते हैं। Layout बनाने के लिए table का उपयोग न करें।

Complete table example
<table>
  <caption>Student Result</caption>
  <thead>
    <tr><th scope="col">Name</th><th scope="col">Marks</th></tr>
  </thead>
  <tbody>
    <tr><td>Ravi</td><td>85</td></tr>
    <tr><td>Seema</td><td>92</td></tr>
  </tbody>
  <tfoot>
    <tr><td colspan="2">Total students: 2</td></tr>
  </tfoot>
</table>
Example output
Student Result
NameMarks
Ravi85
Seema92
Total students: 2
Modern CSS से table की border, spacing और color control करें। पुराने cellpadding, cellspacing और border attributes की जगह CSS इस्तेमाल करें।

10. Forms और सभी महत्वपूर्ण Input Types

Form user से information लेने के लिए होता है। नीचे के examples सीखने के लिए हैं; data वास्तव में server पर भेजने के लिए backend की जरूरत होती है।

HTML form example
<form action="/submit" method="post">
  <label for="fullname">पूरा नाम:</label>
  <input id="fullname" name="fullname" type="text"
         autocomplete="name" required>

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

  <label for="password">Password:</label>
  <input id="password" name="password" type="password"
         minlength="8" required>

  <label for="age">Age:</label>
  <input id="age" name="age" type="number" min="1" max="120">

  <label for="dob">जन्म तिथि:</label>
  <input id="dob" name="dob" type="date">

  <label for="course">Course:</label>
  <select id="course" name="course">
    <option value="">Select course</option>
    <option value="dca">DCA</option>
    <option value="adca">ADCA</option>
  </select>

  <p>Mode:</p>
  <label><input type="radio" name="mode" value="online"> Online</label>
  <label><input type="radio" name="mode" value="offline"> Offline</label>

  <label><input type="checkbox" name="agree" required>
    मैं सहमत हूँ</label>

  <label for="message">Message:</label>
  <textarea id="message" name="message" rows="4"></textarea>

  <button type="submit">Submit</button>
  <button type="reset">Reset</button>
</form>

Input type reference

Typeउपयोग
textसाधारण text
passwordपासवर्ड input
emailEmail validation
numberसंख्या
telफोन नंबर
urlWebsite URL
date, time, datetime-localतारीख और समय
month, weekमहीना / सप्ताह
checkbox, radioएक या अनेक विकल्प
fileFile select
rangeSlider
colorColor picker
searchSearch field
hiddenHidden form value; इसे secret storage न समझें
submit, reset, buttonForm actions
Client-side validation उपयोगी है, लेकिन security के लिए server-side validation भी जरूरी है। Password, API keys या sensitive data को HTML source में न रखें।

11. Semantic HTML Tags

Semantic tags अपने content का अर्थ बताते हैं। इससे code समझना, accessibility और search engines के लिए structure पहचानना आसान होता है।

Semantic page layout
<header>
  <h1>My Website</h1>
</header>
<nav aria-label="Main navigation">
  <a href="#home">Home</a>
  <a href="#about">About</a>
</nav>
<main id="home">
  <article>
    <h2>Article title</h2>
    <p>Article content...</p>
  </article>
  <section id="about">
    <h2>About section</h2>
    <p>Section content...</p>
  </section>
  <aside>Related information</aside>
</main>
<footer>Copyright information</footer>
Tagकाम
<header>Page या section का introductory हिस्सा
<nav>Navigation links
<main>मुख्य content
<section>विषय के अनुसार section
<article>स्वतंत्र content, जैसे article या post
<aside>संबंधित अतिरिक्त content
<footer>Footer information
<address>संपर्क जानकारी
<time>तारीख या समय

12. Audio, Video, Iframe और Embedded Content

Audio

Audio example
<audio controls>
  <source src="music.mp3" type="audio/mpeg">
  आपका browser audio support नहीं करता।
</audio>

Video

Video example
<video controls width="640" poster="cover.jpg">
  <source src="lesson.mp4" type="video/mp4">
  आपका browser video support नहीं करता।
</video>

Iframe

Iframe example
<iframe
  src="https://example.com"
  title="Example website"
  width="600"
  height="350"
  loading="lazy">
</iframe>
कई websites security policy के कारण iframe में खुलने की अनुमति नहीं देतीं। Video/audio files का path सही होना चाहिए और media file आपके पास उपलब्ध होनी चाहिए।

13. HTML Attributes

Attributes element की अतिरिक्त जानकारी देते हैं। इन्हें opening tag में लिखा जाता है।

Attribute examples
<p id="intro" class="highlight" title="Introduction">
  Welcome
</p>

<img src="photo.jpg" alt="Student photo" width="200">

<input type="text" name="username" placeholder="नाम लिखें"
       required maxlength="40">

<button type="button" disabled>Unavailable</button>

<p data-course="html">Custom data attribute</p>
Attributeकाम
idएक element की unique पहचान
classकई elements पर shared styling/selection
styleInline CSS; बड़े projects में CSS file बेहतर
titleअतिरिक्त advisory information
hrefLink का destination
srcImage/media/script का source path
altImage का text alternative
nameForm field का submitted name
valueInput/option की value
requiredField भरना आवश्यक
placeholderInput का hint; label का replacement नहीं
data-*Custom data attribute
hiddenElement को सामान्य display से छिपाना
langContent/document की भाषा
dirText direction, जैसे ltr या rtl

14. HTML Entities और Symbols

कुछ special characters सीधे लिखने के बजाय character references से दिखाए जाते हैं।

EntityOutputकाम
&lt;<Less than
&gt;>Greater than
&amp;&Ampersand
&quot;"Double quote
&copy;©Copyright
&reg;®Registered
&nbsp;non-breaking spaceLine break रोकने वाला space
&euro;€Euro sign

15. Head, Meta Tags और Favicon

Head section example
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="HTML सीखने के आसान notes">
  <title>HTML Notes - Palak Infotech</title>
  <link rel="icon" href="favicon.png" type="image/png">
  <link rel="stylesheet" href="style.css">
  <script src="app.js" defer></script>
</head>
  • charset text encoding तय करता है।
  • viewport mobile responsive layout के लिए जरूरी है।
  • description page का summary देती है।
  • title browser tab में दिखाई देता है।
  • favicon tab में छोटा icon दिखाता है।

16. HTML के साथ CSS और JavaScript

HTML content बनाता है, CSS design करती है और JavaScript page को interactive बनाती है।

CSS example
<style>
  body { font-family: Arial, sans-serif; }
  h1 { color: #04aa6d; }
  .note { background: #fff4a3; padding: 12px; }
</style>

<h1>Hello HTML</h1>
<p class="note">यह styled paragraph है।</p>
JavaScript example
<button type="button" onclick="showMessage()">Click Me</button>
<p id="result"></p>

<script>
  function showMessage() {
    document.getElementById("result").textContent =
      "Welcome to HTML learning!";
  }
</script>
Try this interaction

Button दबाने पर message यहाँ दिखेगा।

17. Accessibility और अच्छी Coding Practices

  • हर form input के लिए <label> का उपयोग करें।
  • Meaningful images में उपयोगी alt text लिखें।
  • Heading hierarchy को व्यवस्थित रखें; heading केवल बड़ा text दिखाने के लिए न चुनें।
  • Link text साफ हो, जैसे “HTML notes पढ़ें” — केवल “यहाँ क्लिक करें” से बचें।
  • Keyboard से links, buttons और forms चल सकें, इसका ध्यान रखें।
  • HTML tags सही तरीके से nest करें और document में unique id रखें।
  • Color को अकेले information बताने का तरीका न बनाएं।
  • Input के लिए केवल placeholder पर निर्भर न रहें; label दें।
अच्छा HTML वही है जो valid, readable, responsive और सभी users के लिए उपयोगी हो।

18. पुराने Tags जिनसे बचना चाहिए

कुछ पुराने HTML tags पुराने documents में मिल सकते हैं, लेकिन नए projects में modern HTML और CSS इस्तेमाल करें।

पुराना तरीकाबेहतर तरीका
<font color="red">CSS color: red;
<center>CSS text-align: center;
<big>CSS font-size
<strike>संदर्भ के अनुसार <del> या CSS
Table-based layoutCSS Flexbox / Grid

19. HTML Tag Cheat Sheet

CategoryImportant tags
Document!DOCTYPE, html, head, title, meta, link, body
Texth1-h6, p, br, hr, pre, blockquote, q, abbr
Formattingstrong, b, em, i, u, mark, small, del, ins, sub, sup, code
Links & imagesa, img, picture, source, figure, figcaption
Listsul, ol, li, dl, dt, dd
Tablestable, caption, thead, tbody, tfoot, tr, th, td, colgroup, col
Formsform, label, input, textarea, select, option, optgroup, button, fieldset, legend, datalist, output, progress, meter
Semanticheader, nav, main, section, article, aside, footer, address, time
Mediaaudio, video, source, track, iframe, canvas, svg
Interactivedetails, summary, dialog
Scriptingscript, noscript, template

Useful extra elements

Details, progress and meter
<details>
  <summary>HTML क्या है?</summary>
  HTML web page की structure बनाने की markup language है।
</details>

<label for="progress">Course progress:</label>
<progress id="progress" value="65" max="100">65%</progress>

<label for="score">Score:</label>
<meter id="score" min="0" max="100" value="80">80 out of 100</meter>

20. Practical Assignments

इन tasks को Notepad या किसी code editor में खुद बनाइए। हर file को .html extension से save करके browser में open करें।

  1. अपना परिचय देने वाला page बनाएं जिसमें h1, h2 और paragraph हो।
  2. अपने institute के लिए course list बनाएं: ordered और unordered list दोनों।
  3. तीन विद्यार्थियों के नाम और अंक वाली table बनाएं।
  4. नाम, email, phone, course dropdown और submit button वाला admission form बनाएं।
  5. एक image जोड़ें और meaningful alt text दें।
  6. किसी दूसरी website का link नए tab में खोलें।
  7. header, nav, main, section और footer से website layout बनाएं।
  8. Audio या video element का example चलाएं।
  9. CSS से heading का color और page का background बदलें।
  10. JavaScript button से paragraph का text बदलें।
Revision formula: पहले structure → फिर text → links/images → lists/tables → forms → semantic tags → CSS → JavaScript.