Namaskar Doston,
Doston agar aap HTML attributes kya hote hai example ke sath poori jaankari chahte ho, toh yeh article aapke liye hai. Yeh beginner-friendly guide aapko attributes ke real-life use, syntax, examples aur FAQs sab kuch easy Hinglish mein samjhayegi.
Aaj ke Article mein Hum Cover Karenge:
- HTML Attributes Kya Hote Hain?
- HTML Attributes Kaise Kaam Karte Hain?
- Top 5 Common HTML Attributes (Examples Ke Saath)
- HTML Tag aur Attribute Mein Kya Difference Hai?
- Global Attributes Kya Hote Hain?
- Real-Life Code Example with Multiple Attributes
- FAQs β Beginners ke Common Sawal
1. HTML Attributes Kya Hote Hain?
Doston, HTML attributes kisi bhi HTML tag ke andar extra information add karte hain. Simple shabdon mein, attribute ka kaam hota hai kisi HTML element mein aur zyada detail provide karna β jaise uska link, style, ID ya koi aur property.
Real-Life Example Samjho:
Socho aapke phone mein βAmitβ ka contact save hai:
- Naam: Amit (yeh HTML tag ki tarah hai)
- Phone No., Email, Address: Yeh sab HTML attribute ki tarah hai
Waise hi, HTML mein:
<a href="https://google.com">Google</a>
Yahaan <a>
tag hai aur href
uska attribute hai jo link ka destination define karta hai.
Syntax of HTML Attributes:
<tagname attributeName="value">Content</tagname>
2. HTML Attributes Kaise Kaam Karte Hain?
- Attributes kisi tag ke behavior ya appearance ko modify karte hain.
- Inka kaam hota hai extra functionality dena jaise styling, linking, tooltip, etc.
- Examples:
href
,src
,alt
,id
,class
,style
,title
, etc.
3. Top 5 Common HTML Attributes (Table Format)
Sr. No. | Attribute | Use (Kis Kaam Aata Hai?) | Example |
---|---|---|---|
1 | href | Clickable link banane ke liye | <a href="https://google.com">Visit Google</a> |
2 | src | Image ka source define karne ke liye | <img src="image.jpg"> |
3 | alt | Image load na ho toh alternate text dikhane ke liye | <img src="image.jpg" alt="My Photo"> |
4 | id | Unique identity dene ke liye | <h1 id="mainHeading">Welcome</h1> |
5 | class | Group styling dene ke liye | <div class="box">This is a box</div> |
4. HTML Tag Aur Attribute Mein Kya Difference Hai?
Point | HTML Tag | HTML Attribute |
---|---|---|
1 | Content define karta hai | Extra info provide karta hai |
2 | < > ke andar hota hai | Tag ke opening part ke andar hota hai |
3 | Required hota hai | Optional hota hai |
4 | <p>Hello</p> |
<p style="color:red">Hello</p> |
5. Global Attributes Kya Hote Hain?
- Global attributes wo hote hain jo kisi bhi HTML element ke sath use kiye ja sakte hain.
- Yeh kisi specific tag tak limited nahi hote.
Example:
<p id="intro" class="highlight" style="color: blue;">Welcome to HTML</p>
Yahaan id
, class
, style
β sab global attributes hain.
6. Real-Life Code Example with Multiple Attributes
<p id="intro-text" class="highlight" style="color: darkblue; font-size: 18px;" title="This is a welcome message."> Welcome to <a href="https://programmingsikho.com" target="_blank" style="color: green; text-decoration: none;" title="Visit My Blog">Programming Sikho</a> β Learn web development in Hinglish! </p>
Explanation Table:
Tag | Attribute | Value | Explanation |
---|---|---|---|
<p> | id | “intro-text” | Unique identity ke liye |
<p> | class | “highlight” | Styling class ke liye |
<p> | style | “color: darkblue; font-size: 18px;” | Inline styling ke liye |
<p> | title | “This is a welcome message.” | Tooltip ke liye |
<a> | href | “https://programmingsikho.com“ | Link ka destination |
<a> | target | “_blank” | Link new tab mein open ho |
<a> | style | “color: green; text-decoration: none;” | Link styling ke liye |
<a> | title | “Visit My Blog” | Tooltip show karne ke liye |
7. FAQs β Beginners ke Common Sawal
1. HTML ke elements aur attributes kya hote hain?
HTML elements page ka structure define karte hain. Attributes un elements mein extra details ya functionality add karte hain.
2. HTML attributes ka use web development mein kyun hota hai?
Inka use styling, linking, form validation, tooltips, id ya class ke through JavaScript ke liye hota hai.
3. Kya har HTML tag mein attribute use kiya ja sakta hai?
Nahi, zaroori nahi hai. Lekin zyada tar tags attributes ko support karte hain β especially global attributes.
4. HTML attribute likhne ka sahi syntax kya hai?
<img src="image.jpg" alt="Description">
Yahaan src
aur alt
dono attributes sahi syntax mein likhe gaye hain: attribute="value"
Conclusion
Toh Dosto Ab aapko clearly samajh aa gaya hoga ki HTML Attributes Kya Hote Hai Example Ke Sath, unka syntax kya hai, aur real-world mein unka use kaise hota hai.
Agar aapko yeh article helpful laga ho to ise share karein, comment karein, aur apne doston ko bhi recommend karein.
Next article kis topic par chahiye? Comment karke zarur batao.
Next Article Padhein:
HTML Elements in Hindi β Block & Inline Explained with Examples (2025)
Written by: Aditya (Programming Sikho)