HTML in Hindi Attributes




HTML मे Attribute वह Technique है जिसके माध्यम से हम अपने Elements की Additional Information प्रदान कराते है. यह Start Tag के साथ Specify होता है. Attributes भी जोड़े के रूप मे आते है पहले Attribute का नाम और दुसरी Attribute की Value आती है. Attribute की Value को आम तौर पर हम Double Quote मे Close करते है. आप इसमे Single Quote का भी उपयोग कर सकते है.

For Example

<!DOCTYPE html>
<html>
   <head>
      <title>Attribute Example</title>
   </head>
   <body>
      <a href="http://tutorialsroot.com/">Click Here</a>
   </body>
</html>

Output

Attribute Example Click Here

इस उदाहरण मे <a> एक Tag है जिसका उपयोग हम HTML मे Hyperlink के लिए करते है यहाँ पर <a> Tag के बाद जो href शब्द लिखा है वही <a> Tag का Attribute है जो <a> Tag को अतिरिक्त जानकारी प्रदान करता है. href Attribute का उपयोग लक्ष्य Address Set करने के लिए किया जाता है. इस Address मे आप किसी भी Website का पेज Address Set कर सकते है साथ ही साथ आप अपनी Website का पेज Address भी Set कर सकते है.

हम कभी-कभी एक Element के अंदर अतिरिक्त Information का Communication करना चाहते है तो इस मामले मे हम एक Attributes का उपयोग करते है.

Attributes का उपयोग Element की विशेषताओं को Define करने के लिए किया जाता है और इसका उपयोग Element के Opening Tag के अंदर किया जाता है.

Attributes HTML Elements के बारे मे अधिक जानकारी प्रदान करते है. HTML मे जितने भी Tag है उन सब के Attributes होते है. Attributes सिर्फ प्रारंभिक Tag मे परिभाषित किया जाता है. और ये नाम और मान की जोड़ी में लिखे जाते है जैसे कि name="value".

Common HTML Attributes

Attribute Options Example
align right, left, center <p align="left">This is left aligned</p>
<p align="center">This is center aligned</p>
<p align="right">This is right aligned</p>
style Cascading Style Sheet <p style="font-family:arial; color:#FF0000;">Some text...</p>
bgcolor numeric, hexidecimal, RGB values <body style="background-color:#FF0000;"></body>
id User Defined <p id="htm">Some text...</p>
class User Defined <p class="important">This is important paragraph</p>
title User Defined <p title="welcome">Some text...</p>

The xml:lang Attribute

xml:lang Attribute जो कि Lang Attribute के लिये XHTML Replacement है. इसका Purpose सभी अलग-अलग XML Document Types को भाषा पहचान के लिए एक ही Attribute का उपयोग करने की अनुमति देना होता है.

xml:lang Attribute सभी Attributes पर उनके आदेश पर ध्यान दिए बिना और उस Element के Content पर लागू होती है.

Generic Attributes

यहां कुछ अन्य Attributes की एक Table है जो कि बहुत से HTML Tags के साथ आसानी से प्रयोग करने योग्य है.

Attribute Options Example
align right, left, center यह एक horizontally aligns tags होता है जिससे हम content को right, left, center से set कर सकते है.
valign top, middle, bottom यह एक Vertically aligns tags होता है जिससे हम content को top, middle, bottom से set कर सकते है.
bgcolor numeric, hexidecimal, RGB values इसका उपयोग एक element के पीछे के background को different color देने के लिये करते है.
background URL यह एक element के पीछे एक background image को रखता है.
id User Defined Id का उपयोग Cascading Style Sheets मे User define करने के लिये किया जाता है.
class User Defined Class का उपयोग Cascading Style Sheets User define करने के लिये किया जाता है.
width Numeric Value Width का उपयोग tables, images, table cells को specifies करने के लिये किया जाता है.
height Numeric Value Height का उपयोग tables, images, table cells को specifies करने के लिये किया जाता है.
title User Defined Title HTML के webpage मे top पर define किया जाता है.