- HTML attributes हमे HTML elements के बारे में additional information provide कराते है।
- Attributes हमेशा start tag के साथ apply की जाती है।
- Attribute को हमेशा उसके name और value के pair के साथ लिखा जाता है।
- Attributes के name और value , case sensitive होते है। अतः W3C द्वारा यह रेकमेंड किया गया है कि इसे केवल lowercase में लिखा जाना चाहिए।
Syntax
<element attribute_name="value">content</element>
title Attribute
title attribute का उपयोग अधिकांश ब्राउज़र में text tooltip के रूप में किया जाता है। जब user किसी लिंक या किसी text पर कर्सर ले जाता है तो यह अपनी value को tooltip के रूप display करता है। आप उस लिंक या text के बारे में description दिखाने के लिए किसी भी text या लिंक के साथ इसका उपयोग कर सकते हैं। उदाहरण में, हम paragraph tag के साथ इसका उपयोग करेंगे |
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 title="This is heading tag">Example of title attribute</h1>
<p title="This is paragraph tag">This is paragraph tag"> HTML is an acronym which stands for Hyper Text Markup Language
which is used for creating web pages and web applications. </p>
</body>
</html>

href Attribute
href attribute anchor tag का मुख्य attribute है। href attribute किसी page के URL को specifie करता है।
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 title="This is heading tag">Example of href attribute</h1>
<p title="This is paragraph tag"> HTML is an acronym which stands for Hyper Text Markup Language
which is used for creating web pages and web applications. </p>
<a href="https://thetechnicalnotes.com/">Visit thetechincalnotes.com</a>
</body>
</html>

src Attribute
src attribute, image tag का मुख्य attribute है। src attribute display होने वाले image के path को specifie करती है।
<!DOCTYPE html>
<html>
<body>
<h2>The src Attribute</h2>
<p>HTML images are defined with the img tag, and the filename of the image source is specified in the src attribute:</p>
<img src="boy.jpg" width="300" height="350">
</body>
</html>

style Attribute
style attribute का उपयोग किसी element में style को add करने के लिए किया जाता है जैसे की color ,font ,size आदि।
<!DOCTYPE html>
<html>
<body>
<h1>The style Attribute</h1>
<p style="color:red;">This is a red paragraph.</p>
<p style="color:blue;" >The style attribute is used to add styles to an element, such as color:</p>
</body>
</html>

lang Attribute
वेब पेज की लैंग्वेज को declare करने के लिए lang attribute को हमेशा <html > के अंदर include करना चाहिए।
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
lang attribute में language कोड में Country कोड भी add कर सकते हैं। तो, पहले दो अक्षर HTML page की language को define करते हैं, और अंतिम दो अक्षर Country को define करते हैं।
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>