Jitna bhi html elements hum use karte hai unn sab elements ka html attribute bhi hota hai , html attribute additional information provide karta hai html element ka. Isme sirf hum start tag use karte hai attribute mein.
href Attribute
href attribute hamesha URL ke liya use kiya jata hai , Jab bhi hume ek page sa dusra page par jana hota hai to hum href attribute ka use karte hai. href attribute ka use hum hamesha anchor tag ke sath karte hai (Anchor tag - <a> ).
Example:
<html>
<head>
<title>Document</title>
</head>
<body>
<a href="https://www.google.com/">Go To Google</a>
</body>
</html>
Output:
Src Attribute
src attribute hum image ke liya use karte hai , src attribute hamesha <img> tag ke sath use karte hai
or isme hum apni image ko height or width bhi deta hai, matlab humara image jo show karwani hai uska size kitna ho display mein etc ,
Example
<html>
<head>
<title>Document</title>
</head>
<body>
<img src="/darkwallpaper.jpg" width="400"height="200">
</body>
</html>
Output:
App dek sakte image display mein show kesa ho rhi hai sabse phele humne img tag ka use kiya uske baad humne src attribute ka use kiya fir humne width or height dekr apni image ka size display par adjust kiya, App khud isko ek baar pratice karo app samaj jaoge kon sa attribute kesa work karta hai .
alt Attribute:
alt attribute ka use hum isliya karte hai ki kabi kabi hum jab image use karte hai lekin vo image display par show nahi hoti yha agar image show bhi ho rhi ho to image kiske bare mein hai vo lika atta hai
Chalo mein apko example mein samjata ho mein abb image ka url galt daloga jissa meri image display par show to nahi hogi lekin image meri kiss bare mein thi vo zurrur show hoga
Example :
<html>
<head>
<title>Document</title>
</head>
<body>
<img src="arkwallpaper.jpg" width="200"height="100" alt="darkwallpaper">
</body>
</html>
Output:
style Attribute
style attribute hum apne elements ko customize karne ke liya use karte hai matlab text ka colour , yha background colour yeh sab change karne ke liya hum style attribute ka use karte hai
Jesa example ke liya mann lo merko text ka colour change karna hai
Example:
<html>
<head>
<title>Document</title>
</head>
<body>
<p style="color: red;">My name is Rakshak Thakur</p>
</body>
</html>
Output:
Abb agar merko ussi text ka background colour bhi change karna hoga to mein simple usko aise likoga
Example :
<html>
<head>
<title>Document</title>
</head>
<body>
<p style="background-color:yellow;">My name is Rakshak Thakur</p>
</body>
</html>
Output:





