HTML Attributes In Hindi

📔 : HTML 🔗

Attributes HTML में defined कुछ special keywords होते हैं जो element के बारे में additional information देता हैं। हर एक elements के एक या एक से ज्यादा attributes हो सकते हैं।

  1. सभी html elements में attributes होते है।
  2. attributes हमें elements के बारे में additional information देते है।
  3. attributes always start tag से specified होते है।.
  4. attributes usually name /value pairs में आते है जैसे name="value".

कुछ attributes इस तरह से हैं -

href attribute

The href attributes URL <a> tag में को specifies करता है।

<a href="/php">Learn PHP</a>

src attribute

src attribute <img> tag में image के path को specify करके display करता है। हालाँकि हम एक से ज्यादा attributes भी use कर सकते हैं।

width and height attribute

image tag में width और height attributes भी use कर सकते हैं ताकि image की width और height को control कर सके ।

<img src="/assets/favicon.png" width="500" height="600">

alt attribute

यह एक image के alternate text को specify करता है means अगर वह image display नहीं होती या image दिए गए url पर found नहीं है तो ये text show जायगा।

<img src="any_random_img.jpg" alt="It's a random image">

style attribute

यह element में CSS style add करता है।

<p style="color:red;">This is a red paragraph.</p>

lang attribute

यह HTML document की language declare करता है।

<!DOCTYPE html>
<html lang="en">
 <body>
  ...
 </body>
</html>

title attribute

यह किसी element के बारे में extra information define करता है। जिससे जब भी उस element पर cursor लाते हैं तो वही information show होती है।

<p title="You will see this on mouse over.">simple paragraph</p>

class attribute

class attribute का use किसी भी element पर classes define करने के लिए किया जाता है , single class attribute में हम एक या एक से ज्यादा class का name दे सकते हैं।


class attribute का use करके हम elements पर CSS apply करते हैं , और JavaScript DOM के through HTML content को dynamic बनाते हैं।

//single class
<p class="highlight">This is a paragraph.</p>

//multiple class
<div class="box highlight">Some content</div>

id attribute

जैसा इसके name से ही पता चलता है , id attribute का use किसी भी element पर unique name define करने के लिए किया जाता है। किसी element में सिर्फ एक ही id attribute हो सकता है।

<p id="my_info">It's all about me.</p>

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers