·
Introduction to HTML Attributes in Hindi
·
Scope of HTML attributes in Hindi
·
Common HTML attributes in Hindi
·
Some more common HTML tags in Hindi
Introduction to HTML Attributes
जितने भी HTML tags होते है उन सबके attributes होते है। ये name और value के pair में लिखे जाते है। Attributes के द्वारा आप tags को अपने according
configure कर सकते है। Attributes को हमेशा starting tag में define किया जाता है। इन्हे define करने का उदाहरण नीचे दिया जा रहा है।
<tagName
attrName="value">
some
text here.
</tagName>
|
Attributes advanced configuration के लिए यूज़ किये जाते है। जैसे की आप default page background नहीं चाहते तो उसको अपने according change कर सकते है। ऐसे ही आप यदि default text color नहीं चाहते है तो उसे भी change कर सकते है। Attributes को यूज़ करना बहुत ही simple है। बस आपको पता होना चाहिए की कौनसा attribute किस जगह यूज़ करना है। आगे attributes से related एक simple उदाहरण नीचे दिया जा रहा है।
<html>
<head>
<title>myPage</title>
</head>
<body
bgcolor="black">
<h1
style="color:pink"> Heading </h1>
<p
style="color:yellow">
This is
a paragraph. And you are learning html in Hindi.
</p>
</body>
</html>
|
उपर दिए हुए example में 2 जगह attributes यूज़ किये गए है। सबसे पहले <body> tag में bgcolor attribute यूज़ करते हुए page का background color define किया गया है। जब आप default body tag यूज़ करते है तो page का background color white रहता है। लेकिन जैसा की मैने आपको बताया की आप attributes के द्वारा page और text अपने according configure कर सकते है। इस attribute के द्वारा आप जो background अपने page का रखना चाहते है वो रख सकते है। जैसे की मैने example में black दिया है। ऊपर दी गयी script निचे दिया गया output generate करेगी।
दूसरा attribute paragraph tag में यूज़ किया गया है। ये style attribute है। इस attribute के द्वारा आप tag पर CSS (Cascading Style Sheet) apply कर सकते है। CSS के द्वारा advanced configuration किया जाता है, जिसके बारे में आप आगे पड़ेंगे। जैसे की आप देख सकते है style attribute के द्वारा CSS apply किया गया है। इससे text का color change किया जाता है। और ऐसा ही heading tag के साथ भी किया गया है।
Scope of HTML Attributes
Attributes का scope उनके tags के according होता है। जिस tag के साथ आप जो attribute apply करते है वो उसी tag तक रहता है। जैसे की आपने body tag में style tag को यूज़ करते हुए text color red define किया है। Body tag पुरे page के लिए होता है इसलिए ये attribute पुरे page के text को red में show करेगा। लेकिन ऐसा तब तक ही होगा जब तक कोई body tag से छोटा tag text को दूसरे color में define नहीं करता है। जैसे की आप आगे चलकर किसी paragraph tag का color green define करते है। तो ये color body tag के color को override करेगा। और आपका ये paragraph green text में show होगा। इसका उदाहरण निचे दिया जा रहा है। इसे आप execute करवा कर देख सकते है।
<html>
<head>
<title>
myPage </title>
</head>
<body
style="color:red">
Learn
html in Hindi <br>
Lean
html in Hindi in 2 days. <br>
Learn
html in Hindi pdf.
<p
Style="color:green">
This is
some text here
</p>
</body>
</html>
|
उपर दिए हुए उदाहरण में आप देख सकते है की paragraph का text color अलग से define किया गया है। ये body के text color को override करता है। इस script को run करने पर निचे दिया गया output show होगा।
HTML attributes को यूज़ करने की कुछ guide line होती है। जिनको follow करके आप attributes का बेहतर इस्तेमाल कर सकते है। इनके बारे में नीचे दिया जा रहा है।
Guidelines For Using HTML
Attributes
1.
हमेशा attributes को lower case में define करे।
2.
हमेशा attributes की values quotation mark में ही define करे।
Common HTML Attributes
नीचे आपको HTML में commonly यूज़ होने वाले attributes की list दी जा रही है।
Attribute
|
Explanation
|
Example
|
id
|
HTML
document में किसी tag को uniquely identify करने के लिए id attribute यूज़ किया जाता है। किन्ही 2 tags की id same नहीं हो सकती है।
|
<p
id="mypara">
|
class
|
ये attributes tags को अलग अलग class में categories करने के लिए यूज़ किया जाता है। बहुत से tags एक class के हो सकते है।
|
<h1
class="java">
|
title
|
किसी tag का tittle देने देने के लिए title attribute यूज़ किया जाता है।
|
<p
title="Hello">
|
style
|
इस attribute के द्वारा आप tag पर style rules apply कर सकते है।
|
<p
style="color:red">
|
Some More Common HTML Tags
कुछ और common tags के बारे में नीचे दिया जा रहा है। इन tags का इस्तेमाल आगे आने वाली tutorials में किया जायेगा।
Tags
|
Explanation
|
<h1> </h1> |
ये heading tag होता है। इससे page की heading define की जाती है। इसे आप किसी
paragraph से पहले यूज़ कर सकते है और उसकी heading define कर सकते है। इसकी text size पुरे page में सबसे large होती है।
|
<h2> </h2> |
ये भी heading tag होता है। लेकिन इसकी text size <h1> tag से कम होती है। इसे heading के बाद
subheading declare करने के लिए यूज़ किया जाता है।
|
<h3> </h3> |
ये भी heading tag होता है। इसे subheading के बाद minor heading declare करने के लिए यूज़ किया जाता है। इसकी text size sub heading से कम होती है।
|
<p> </p> |
ये paragraph tag होता है। इसके द्वारा आप एक
paragraph अपने page में लिख सकते है और उसको
different attributes के द्वारा position कर सकते है। किसी paragraph पर होने वाली सभी formatting आप इस tag के attributes के द्वारा कर सकते है।
|
<br
/>
|
ये tag line को break करने के लिए यूज़ किया जाता है। इस tag के बाद का text दूसरी line में शो होता है।
|





No comments:
Post a Comment