This Website for Those Students who are searching for a platform to study online in their own Language Hindi, on this website they will learn all courses like IAS, programming, web designing, data science, and competitive exam preparation, etc.


HTML : Attributes

HTML Attribute

HTML : Attribute





हेलो दोस्तों कैसे हो आप लोग उम्मीद है की आपको Last Posts पसंद आये होंगे तो HTML के कोर्स को अगर बढ़ाते है|

तो आज हम HTML के Attributes के बारे में जानेंगे|
चलिए शरू करते है।

Attributes

Attributes ये Elements का एक structure होता है | Attributes के जरिये Elements पर कुछ information दी जाती है |

Html मे जब भी coding की जाती है | तो HTML tags create किये जाते है | और उन tags के अन्दर Attributes भी define किये जाते है | कुछ html tag ऐसे होते है जिनका खुद का Attributes होता है और कुछ html tag ऐसे होते है जिनका Attributes नही होता है लेकिन अगर हम चाहे तो उनमे Attributes create कर सकते है |

HTML के सभी Elements के लिए attribute होता है | एक Element पर एक या एक से ज्यादा attributes हो सकते है |

Attribute की value को single('') या double quotes("") के बीच में लिखा जाता है, लेकिन कुछ attributes को singl या double quotes की जरुरत नहीं होती है |

Syntax of Html Attributes



Example:

<ele_name attr_name1="value1" attr_name2="value2">content</ele_name>

सभी Attributes दो parts से मिलकर बने होते है.

name and value.

name एक property है, जिसे आप set करना चाहते है। For Example – image को extra configure करने के लिए src attribute का use किया जाता है।

तो यहां पर image tag के attribute का name src है।

जिसका उपयोग हम image को extra configure करने के लिए करेंगे। value वह है, जो आप property के द्वारा उस element में Set करना चाहते है।

जब हम html language का use करके एक web page बनाते है तो बहुत सारे html tags बनाने पड़ते है और web page को अपने according customize करना चाहते है | तो उसके लिए Attributes का use करना पड़ता है क्योकि बिना Attributes के web page customize नही कर सकते है

अब तक तो शायद आपको समझ आ गया होगा की HTML attribute क्या होता है? और इसका उपयोग हम Html element को additional information provide करने के लिए कैसे कर सकते है। तो चलिये अब Html में अधिकांश उपयोग होने वाले कुछ Html attribute के बारे में जानते है।

Some important HTML Attributes



वैसे तो Html attribute list बहुत लंबी है, जिसे example के साथ एक पोस्ट में बता पाना मुश्किल है। लेकिन कुछ ऐसे HTML attribute है, जिनका उपयोग Html में सबसे ज्यादा होता है। इसीलिए उन्हें नीचे उदाहरण के साथ बताया गया है।

Types of Attributes



HTML Attributes को पढने की सुविधा के लिए चार श्रेणियों में विभाजित किया गया है. Attributes की इन चार श्रेणियों के बारे में नीचे बताया जा रहा

है

.


  • Required Attributes
  • Optional Attributes
  • Standart Attributes
  • Event Attributes

Required and Optional Attributes


Required और Optional Attributes लगभग एक जैसे ही होते है. इनका इस्तेमाल किसी विशेष HTML Element या कहें कि HTML Tag को Modify करने के लिये किया जाता है. आप चित्र वाले उदाहरण से इन्हें समझ सकते है. जिसमें src Attribute एक Required Attribute है और alt एक Optional Attribute है.


Standard Attribute


Standard Attributes अधिकतर HTML Elements पर Apply होते है. इन्हें Global Attributes भी कहते है. आप Standard Attribute को Required एवं Optional Attributes के साथ-साथ ही इस्तेमाल कर सकते है.


Event Attributes



Event Attributes का उपयोग किसी खास परिस्थिति में किसी विशेष कार्य को Run कराने के लिये किया जाता है.



Global Attributes

Html मे Global Attributes वो Attributes होते है जो html के हर tag मे use किये जाते है या कर सकते है Global Attributes दो प्रकार के होते है |


  • ID Attributes
  • Class Attributes


ID Attributes


Id attribute के द्वारा html tags को एक unique नाम दिया जाता है | ताकि हमारे html tag पर आसानी से css apply हो सके |


<tagname id="id-name"> your content </tagname>

Class Attributes

Class attribute भी id attribute की तरह ही होता है। किसी भी tag का unique name देने के लिए id और class का use किया जाता है |
id और class मे सिर्फ { ( Dot . ) और ( Hash # ) } का difference होता है |
यानी css लिखने के लिए id को ( # ) Hash से represent किया जाता है |
और class को एक ( . ) dot से represent किया जाता है | ताकि आसानी से css लिख सके |


<tagname class="class-name"> your content </tagname>


Style Attributes

इस Attributes का use html के किसी भी tag पर css apply करने के लिए use किया जाता है | या styling करने के लिए किया जाता है | अब निचे दिये गये example को देखे |


<tagname style="command: value;"> content </tagname>

Width and height Attribute



Html में image का आकार set करने के लिए size attribute का इस्तेमाल होता है। size attribute की help से image की height और width set की जाती है।


Example-:

<!--DOCTYPE html--> <html> <head> <title> Example of Height and Width Attribute </title> </head> <body> <img height="20" loading="lazy" src="set-img-path" width="20" /> html attribute </body> </html>

lang Attributes

इस attribute का use html tags के अन्दर use की गयी language से होता है यानी आप tags के अन्दर कौन सा language use कर रहे है उसे बताने के लिए lang attribute का use किया जाता है |


<tagname lang="EN"> Your language </tagname>

Title Attributes

इस attribute के द्वारा आप किसी भी word का full form दिखा सकते है या उसके बारे में अधिक जानकारी दे सकते है।


<tagname title="Local Area Network"> LAN </tagname>

Accesskey Attribute


इस attribute के द्वारा आप html के किसी tag पर focus create कर सकते है या एक shortcut key define कर सकते है।

<tagname accesskey=""> your content </tagname>

दोस्त उम्मीद है अब आप को HTML Attribute के बारे मै पूरी तरह से समझ गए होंगे अगर फिर भी आपको समझने में या कोई भी Tag समझ नहीं आया तो कमेंट बॉक्स में शेयर करे और आपको हमारा ये पोस्ट केसा लगा जरूर बतायेगा |
Thank You.
Previous
Next Post »

Quote

"Educationists should build the capacities of the spirit of inquiry, creativity, entrepreneurial and moral leadership among students and become their role model."

Dr. Abdual Kalam