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 जोड़ा जाता है।
Web page और website
एक web page एक single document है। कई related web pages मिलकर website बनाते हैं। HTML file सामान्यतः .html extension से save होती है, जैसे index.html।
Welcome to my website
यह मेरा पहला web page है।
2. HTML Document का Basic Structure
हर नए HTML page की शुरुआत इस standard structure से करें।
<!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 होता है।
<img>, <br> और <hr> void elements हैं; इनके closing tags नहीं लिखे जाते।3. Tags, Elements और Nesting
Tag angle brackets में लिखा जाता है। आम तौर पर opening tag + content + closing tag मिलकर element बनाते हैं।
<p>Hello Students</p>
<p>यह <strong>महत्वपूर्ण</strong> text है।</p>| शब्द | मतलब | उदाहरण |
|---|---|---|
| Opening tag | Element शुरू करता है | <p> |
| Content | दिखाया जाने वाला text या content | Hello Students |
| Closing tag | Element समाप्त करता है | </p> |
| Nesting | एक element के अंदर दूसरा element | <strong> अंदर <p> |
4. Headings, Paragraph, Line Break और Horizontal Line
<h1> से <h6> तक छह heading levels होते हैं। Heading level content की hierarchy के अनुसार चुनें, केवल size के लिए नहीं।
<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>मुख्य Heading
Section Heading
Subsection Heading
यह एक paragraph है।
पहली line
दूसरी line
Horizontal line के बाद नया paragraph।
5. Text Formatting Tags
| Tag | उपयोग | Example |
|---|---|---|
<strong> | महत्वपूर्ण text | Important text |
<b> | ध्यान खींचने के लिए bold | Bold text |
<em> | Emphasis | Emphasized text |
<i> | अलग स्वर/technical term | Technical term |
<u> | Annotation underline | Underlined |
<mark> | Highlight | Highlighted |
<small> | छोटा text | Small text |
<del> / <ins> | हटाया / जोड़ा गया text | |
<sub> / <sup> | Subscript / Superscript | H2O, x2 |
<code> | Inline computer code | print("Hello") |
<pre> | Whitespace सहित preformatted text | Line 1 Line 2 |
<blockquote> | लंबा quotation | Knowledge is power. |
<q> | छोटा inline quotation | Learn by doing |
<abbr> | Abbreviation | HTML |
<sup> | ऊपर छोटा text | 10th |
<!-- यह comment browser में दिखाई नहीं देता -->
<p>यह दिखाई देने वाला content है।</p>6. Links (Anchor Tag)
<a> tag से किसी page, website, email या page के section पर link बनाया जाता है।
<a href="https://www.example.com">Website खोलें</a>
<!-- New tab -->
<a href="https://www.example.com" target="_blank"
rel="noopener noreferrer">New tab में खोलें</a>
<!-- उसी page के section पर जाना -->
<a href="#contact">Contact section</a>
<!-- Email link -->
<a href="mailto:info@example.com">Email करें</a>
<!-- Phone link -->
<a href="tel:+911234567890">Call करें</a>rel="noopener noreferrer" जोड़ना अच्छी practice है।7. Images और Figure
Image के लिए <img> का उपयोग करें। Meaningful image के लिए सही alt text देना जरूरी है।
<img src="flower.jpg" alt="लाल फूल" width="300">
<figure>
<img src="computer.jpg" alt="Computer lab" width="320">
<figcaption>हमारी computer lab</figcaption>
</figure>8. Lists (सूचियाँ)
Ordered List
क्रम 1, 2, 3 में सूची।
<ol>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ol>- HTML
- CSS
- JavaScript
Unordered List
Bullet points में सूची।
<ul>
<li>Keyboard</li>
<li>Mouse</li>
<li>Monitor</li>
</ul>- Keyboard
- Mouse
- Monitor
Description List
<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 का उपयोग न करें।
<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>| Name | Marks |
|---|---|
| Ravi | 85 |
| Seema | 92 |
| Total students: 2 | |
cellpadding, cellspacing और border attributes की जगह CSS इस्तेमाल करें।10. Forms और सभी महत्वपूर्ण Input Types
Form user से information लेने के लिए होता है। नीचे के examples सीखने के लिए हैं; data वास्तव में server पर भेजने के लिए backend की जरूरत होती है।
<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 |
| Email validation | |
| number | संख्या |
| tel | फोन नंबर |
| url | Website URL |
| date, time, datetime-local | तारीख और समय |
| month, week | महीना / सप्ताह |
| checkbox, radio | एक या अनेक विकल्प |
| file | File select |
| range | Slider |
| color | Color picker |
| search | Search field |
| hidden | Hidden form value; इसे secret storage न समझें |
| submit, reset, button | Form actions |
11. Semantic HTML Tags
Semantic tags अपने content का अर्थ बताते हैं। इससे code समझना, accessibility और search engines के लिए structure पहचानना आसान होता है।
<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 controls>
<source src="music.mp3" type="audio/mpeg">
आपका browser audio support नहीं करता।
</audio>Video
<video controls width="640" poster="cover.jpg">
<source src="lesson.mp4" type="video/mp4">
आपका browser video support नहीं करता।
</video>Iframe
<iframe
src="https://example.com"
title="Example website"
width="600"
height="350"
loading="lazy">
</iframe>13. HTML Attributes
Attributes element की अतिरिक्त जानकारी देते हैं। इन्हें opening tag में लिखा जाता है।
<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 |
| style | Inline CSS; बड़े projects में CSS file बेहतर |
| title | अतिरिक्त advisory information |
| href | Link का destination |
| src | Image/media/script का source path |
| alt | Image का text alternative |
| name | Form field का submitted name |
| value | Input/option की value |
| required | Field भरना आवश्यक |
| placeholder | Input का hint; label का replacement नहीं |
| data-* | Custom data attribute |
| hidden | Element को सामान्य display से छिपाना |
| lang | Content/document की भाषा |
| dir | Text direction, जैसे ltr या rtl |
14. HTML Entities और Symbols
कुछ special characters सीधे लिखने के बजाय character references से दिखाए जाते हैं।
| Entity | Output | काम |
|---|---|---|
< | < | Less than |
> | > | Greater than |
& | & | Ampersand |
" | " | Double quote |
© | © | Copyright |
® | ® | Registered |
| non-breaking space | Line break रोकने वाला space |
€ | € | Euro sign |
15. Head, Meta Tags और Favicon
<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>charsettext encoding तय करता है।viewportmobile responsive layout के लिए जरूरी है।descriptionpage का summary देती है।titlebrowser tab में दिखाई देता है।favicontab में छोटा icon दिखाता है।
16. HTML के साथ CSS और JavaScript
HTML content बनाता है, CSS design करती है और JavaScript page को interactive बनाती है।
<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><button type="button" onclick="showMessage()">Click Me</button>
<p id="result"></p>
<script>
function showMessage() {
document.getElementById("result").textContent =
"Welcome to HTML learning!";
}
</script>Button दबाने पर message यहाँ दिखेगा।
17. Accessibility और अच्छी Coding Practices
- हर form input के लिए
<label>का उपयोग करें। - Meaningful images में उपयोगी
alttext लिखें। - Heading hierarchy को व्यवस्थित रखें; heading केवल बड़ा text दिखाने के लिए न चुनें।
- Link text साफ हो, जैसे “HTML notes पढ़ें” — केवल “यहाँ क्लिक करें” से बचें।
- Keyboard से links, buttons और forms चल सकें, इसका ध्यान रखें।
- HTML tags सही तरीके से nest करें और document में unique id रखें।
- Color को अकेले information बताने का तरीका न बनाएं।
- Input के लिए केवल placeholder पर निर्भर न रहें; label दें।
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 layout | CSS Flexbox / Grid |
19. HTML Tag Cheat Sheet
| Category | Important tags |
|---|---|
| Document | !DOCTYPE, html, head, title, meta, link, body |
| Text | h1-h6, p, br, hr, pre, blockquote, q, abbr |
| Formatting | strong, b, em, i, u, mark, small, del, ins, sub, sup, code |
| Links & images | a, img, picture, source, figure, figcaption |
| Lists | ul, ol, li, dl, dt, dd |
| Tables | table, caption, thead, tbody, tfoot, tr, th, td, colgroup, col |
| Forms | form, label, input, textarea, select, option, optgroup, button, fieldset, legend, datalist, output, progress, meter |
| Semantic | header, nav, main, section, article, aside, footer, address, time |
| Media | audio, video, source, track, iframe, canvas, svg |
| Interactive | details, summary, dialog |
| Scripting | script, noscript, template |
Useful extra elements
<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 करें।
- अपना परिचय देने वाला page बनाएं जिसमें h1, h2 और paragraph हो।
- अपने institute के लिए course list बनाएं: ordered और unordered list दोनों।
- तीन विद्यार्थियों के नाम और अंक वाली table बनाएं।
- नाम, email, phone, course dropdown और submit button वाला admission form बनाएं।
- एक image जोड़ें और meaningful alt text दें।
- किसी दूसरी website का link नए tab में खोलें।
- header, nav, main, section और footer से website layout बनाएं।
- Audio या video element का example चलाएं।
- CSS से heading का color और page का background बदलें।
- JavaScript button से paragraph का text बदलें।