https://www.rakeshmgs.in/search/label/Template
https://www.rakeshmgs.in
RakeshMgs

Learn Html Free using Tags and Attributes

Updated:



Attributes के बारे में जानने से पहले कुछ और common tags के बारे में नीचे दिया जा रहा है। इन tags का इस्तेमाल आगे आने वाले examples में किया जायेगा।


1. <h1> </h1>

Heading 1

ये heading tag होता है। इससे page की heading define की जाती है। इसे आप किसी paragraph से पहले यूज़ कर सकते है और उसकी heading define कर सकते है। इसकी text size पुरे page में सबसे large होती है।

2. <h2> </h2>



Heading 2

ये भी heading tag होता है। लेकिन इसकी text size <h1> tag से कम होती है। इसे heading के बाद subheading declare करने के लिए यूज़ किया जाता है।

3. <h3> </h3>

Heading 3

ये भी heading tag होता है। इसे subheading के बाद minor heading declare करने के लिए यूज़ किया जाता है। इसकी text size sub heading से कम होती है।


4. <p> </p>

Paragraph

ये paragraph tag होता है। इसके द्वारा आप एक paragraph अपने page में लिख सकते है और उसको different attributes के द्वारा position कर सकते है। किसी paragraph पर होने वाली सभी formatting आप इस tag के attributes के द्वारा कर सकते है।


5. <br />


ये tag line को break करने के लिए यूज़ किया जाता है। इस tag के बाद का text दूसरी line में शो होता है।


6. 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>

this html preview below

some text here.

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>

This Code Preview Here


उपर दिए हुए 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 के साथ भी किया गया है।


7. Scope of 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>


This Code Preview Here

उपर दिए हुए उदाहरण में आप देख सकते है की paragraph का text color अलग से define किया गया है। ये body के text color को override करता है। इस script को run करने पर निचे दिया गया output show होगा।

HTML attributes को यूज़ करने की कुछ guide line होती है। जिनको follow करके आप attributes का बेहतर इस्तेमाल कर सकते है। इनके बारे में नीचे दिया जा रहा है।

8. Guidelines for using HTML attributes
1. हमेशा attributes को lower case में define करे।
2. हमेशा attributes की values quotation mark में ही define करे।

आपको आर्टिकल कैसा लगा? अपनी राय अवश्य दें
Please don't Add spam links,
if you want backlinks from my blog contact me on rakeshmgs.in@gmail.com