If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
Attributes HTML में defined कुछ special keywords होते हैं जो element के बारे में additional information देता हैं। हर एक elements के एक या एक से ज्यादा attributes हो सकते हैं।
कुछ attributes इस तरह से हैं -
The href attributes URL <a> tag में को specifies करता है।
<a href="/php">Learn PHP</a>
src attribute <img> tag में image के path को specify करके display करता है। हालाँकि हम एक से ज्यादा attributes भी use कर सकते हैं।
image tag में width और height attributes भी use कर सकते हैं ताकि image की width और height को control कर सके ।
<img src="/assets/favicon.png" width="500" height="600">
यह एक image के alternate text को specify करता है means अगर वह image display नहीं होती या image दिए गए url पर found नहीं है तो ये text show जायगा।
<img src="any_random_img.jpg" alt="It's a random image">
यह element में CSS style add करता है।
<p style="color:red;">This is a red paragraph.</p>
यह HTML document की language declare करता है।
<!DOCTYPE html> <html lang="en"> <body> ... </body> </html>
यह किसी element के बारे में extra information define करता है। जिससे जब भी उस element पर cursor लाते हैं तो वही information show होती है।
<p title="You will see this on mouse over.">simple paragraph</p>
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>
जैसा इसके name से ही पता चलता है , id attribute का use किसी भी element पर unique name define करने के लिए किया जाता है। किसी element में सिर्फ एक ही id attribute हो सकता है।
<p id="my_info">It's all about me.</p>
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