HTML Attributes Kya Hote Hai? Hello Friends इस article में हम HTML attributes के बारे में बात करेंगे। अगर आप HTML पूरी तरह से सिख चुके तो आपको html में additional improvement के लिए HTML elements , attributes , tags इन सब की knowledge होनी चाहिए।
HTML attributes के बारे में पढ़ने से पहले आपको HTML के बारे में थोड़ा बहुत knowledge होनी चाहिए ,अगर आपको नहीं पता की html क्या होता है , html elements क्या होते है ? , html tags क्या होते है ? तो आप नीचे दिए हुए article के link को open करके read कर सकते है।
- HTML क्या है – What is HTML in Hindi? and Features of HTML in Hindi?
- Html Tag | Html Tag क्या है ? | Types Of Tags | Tag को कैसे use करें ?
- HTML Elements kya Hote hai ? | HTML Elements List
तो चलिए जानते है कि HTML attributes kya hote hai ? इनका use कैसे करते करते है।
HTML Attributes Kya Hai ? ( What is HTML Attribute in Hindi )
HTML attributes HTML elements के बारे में additional information provide करते है। Html Attribute को Name और Value से Define किया जाता है। HTML Attributes का use HTML Tags के features को Define करने के लिये किया जाता है। Html Attribute की Value को हमेशा Double quote ( = ” “ ) के अंदर ही लिखा जाता है।
जब भी हम HTML TAG का use करते है तो उस tag के अंदर कुछ content या information भी डालनी होती है। for example जैसे हमे कोई image insert करनी है तो उसके लिए हम img tag का use करते है।
बिना tag use करे हम image तो क्या कोई content या information भी insert नहीं कर सकते। हम img tag के साथ HTML Attribute ( Src =”img url link ” ) लिखना होता है तभी img web page पर show होगी।
HTML Attribute को हमेशा starting tag के साथ ही लिखा जाता है।
HTML Attribute को हमेशा starting tag के साथ ही लिखा जाता है।
HTML attributes HTML elements के बारे में additional information provide करते है।
Html Attribute को हमेशा Name और Value से Define किया जाता है।
इन्हे भी पढ़ें-
- Bootstrap Progress Bar Kaise Banaye? | Bootstrap Progress Bar
- Bootstrap Grid System Kya Hota Hai ? कैसे काम करता है?
- XML Kya Hai? | What is XML In Hindi | Introduction Of XML
- HTML Elements kya Hote hai ? | HTML Elements List
- CSS Selectors Kya Hai ? | CSS Selectors In Hindi ?
- CSS Kya Hai ? | What is CSS in Hindi | CSS का उपयोग कैसे किया जाता है ?
- Html Tag | Html Tag क्या है ? | Types Of Tags | Tag को कैसे use करें ?
HTML Attributes
The href Attribute
<a> tag hyperlink को define करता है , href attribute specifies करता है page के URL को जिस पर हम उसको भेजना चाहते है।
Example
<a href="https://www.bloomtutorial.com/">Visit site</a>
The src Attribute
src Attribute का use Html के Tag के साथ image के source का path define करने के लिए किया जाता है। मतलब img आपके किस folder या कोन सी file के अंदर है ये define करने के लिए src Attribute का use किया जाता है।
Example
<img src="images/logo.jpg">
Note : हम दो तरह से specify कर सकते है URL को src attribute के अंदर।
- Absolute URL – हम external image का link दे सकते है जो किसी और website पर है : For Example src=”https://www.bloomtutorial.com/images/logo.jpg”. External images पर copyright का issue हो सकता है अगर आप permission नहीं लेंगे use करने की तो।
- Relative URL – link उस image का होता है जो website में host हो रही होती है। यहाँ पर URL domain name के साथ include नहीं होता , अगर URL बिना slash के start होता है ,तो वो current page से relative होगा। Example: src=”logo .jpg”. और अगर URL slash के साथ start होगा तो वो domain name से relative होगा। Example: src=”/images/logo.jpg”.
The width and height Attributes
tag के अंदर width and height attributes भी शामिल होते है , जो कि specifies करते है image की width and height (in pixels):
Example
<img src="logo.jpg" width="200" height="150">
The alt Attribute
alt attribute का use tag में image के लिए alternate text specifie करने के लिए किया जाता है , अगर किसी reason की वजह से image displaye नहीं हो पा रही है। ये या तो slow connection की वजह से होता है ,या कोई error होता है src attribute.
Example
<img src="logo.jpg" alt="bloom logo">
The style Attribute
Style attribute का किसी element में styles को add करने के लिए किया जाता है जैसे color, font, size, and more.
Example
<p style="color:black;">This is a black paragraph.</p>
The lang Attribute
आपको html के अंदर lang attribute हमेशा include करना चाहिए। इस attribute का use Web page की language को declare करने के लिए किया जाता है। इसका मतलब होता है की search engines and browsers की help करना।
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
Country codes को भी language code में add किया जा सकता है lang attribute के अंदर। इसमें first two characters language define करते है ,HTML page की ,और last two characters country को define करते है।
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
The title Attribute
The title attribute किसी element की कुछ extra information को defines करने के लिए use किया जाता है।
<p title="warning">This is a paragraph.</p>
Conclusion
- सभी HTML elements में attributes हो सकते है।
- <a> tag hyperlink को define करता है , href attribute specifies करता है page के URL को जिस पर हम उसको भेजना चाहते है।
- src Attribute का use Html के Tag के साथ image के source का path define करने के लिए किया जाता है।
- The width and height Attributes specifies करते है image की width and height (in pixels):
- alt attribute का use tag में image के लिए alternate text specifie करने के लिए किया जाता है।
- lang attribute का use Web page की language को declare करने के लिए किया जाता है।
- The title attribute किसी element की कुछ extra information को defines करने के लिए use किया जाता है।