Introduction
HTML me sirf Image Tag (<img>) likh dena hi kaafi nahi hota. Browser ko ye bhi batana padta hai ki Image file kahan par rakhi hui hai. Isi location ko Image Path kaha jata hai.
Agar Image Path sahi nahi diya jata, to Browser Image ko find nahi kar pata aur Image display hone ki jagah Broken Image Icon dikhai deta hai. Isliye HTML me Image Path ko samajhna bahut important hai.
Is Article me hum HTML Image Path ko Beginner se Advanced level tak Hinglish me seekhenge. Hum jaanenge ki Local Image Path aur Online Image Path kya hote hain, Relative Path aur Absolute Path me kya difference hota hai aur Images ko sahi tarike se kaise link kiya jata hai.
📚 Is Article Me Aap Kya Seekhenge?
- ✅ HTML Image Path Kya Hai?
- ✅ Image Path Kaise Work Karta Hai?
- ✅ Types of HTML Image Path
- ✅ Relative Image Path
- ✅ Absolute Image Path
- ✅ Local Image Path
- ✅ Online Image Path (URL)
- ✅ Practical Examples
- ✅ Common Mistakes
- ✅ Summary
What Is HTML Image Path?
HTML Image Path us location ya address ko kaha jata hai jahan Image file save hoti hai. Browser isi Path ki help se Image ko find karta hai aur Webpage par display karta hai.
Jab hum HTML me <img> Tag ka use karte hain, to src Attribute ke andar Image ka Path likhte hain. Browser us Path ko follow karta hai aur agar Image file mil jati hai, to use Webpage par show kar deta hai.
Lekin agar Image Path galat ho, Image delete ho chuki ho ya file kisi dusre Folder me move ho gayi ho, to Browser Image display nahi kar pata aur Broken Image Icon dikhai deta hai.
Basic Syntax
<img alt="Image Description" src="image-path" />
Example
<img alt="Nature Image" src="images/nature.jpg" />
Yahan images/nature.jpg Image ka Path hai. Browser isi Path ko use karke nature.jpg Image ko load karta hai aur Webpage par display karta hai.
How Does HTML Image Path Work?
Jab Browser kisi HTML Webpage ko load karta hai, to wo sabse pehle HTML Code ko read karta hai. Agar Browser ko <img> Tag milta hai, to wo src Attribute ke andar diya gaya Image Path check karta hai.
Browser us Path ko follow karta hai aur Image file ko find karne ki koshish karta hai. Agar Image file us location par available hoti hai, to Browser use download karke Webpage par display kar deta hai.
Lekin agar Path galat ho, Image file exist na karti ho ya Browser us location ko access na kar sake, to Image load nahi hoti aur Broken Image Icon dikhai deta hai.
Working Process
- ✅ Browser HTML File ko read karta hai.
- ✅
<img>Tag ke andarsrcAttribute ko check karta hai. - ✅ Diye gaye Image Path ko follow karta hai.
- ✅ Image file ko search karta hai.
- ✅ Image milne par use download karke Webpage par display karta hai.
- ✅ Agar Image na mile, to Broken Image Icon show hota hai.
Types of HTML Image Path
HTML me Images ko load karne ke liye mainly 2 types ke Image Paths use kiye jate hain. Dono ka purpose Browser ko Image ki location batana hota hai, lekin inka use alag-alag situations me kiya jata hai.
Image Path ka sahi type choose karna bahut important hai, kyunki isi par depend karta hai ki Browser Image ko successfully load kar payega ya nahi.
HTML Image Path Ke Types
- 1. Relative Image Path – Jab Image aapki Website ya Project Folder ke andar save hoti hai, tab Relative Path use kiya jata hai.
- 2. Absolute Image Path – Jab Image kisi dusri Website ya Server par online available hoti hai, tab uska complete URL use kiya jata hai.
Dono Image Paths ke apne advantages aur use cases hote hain. Aage hum Relative Image Path aur Absolute Image Path ko detail me Examples ke saath seekhenge.
Relative Image Path
Relative Image Path us Path ko kaha jata hai jo current HTML File ke location ke according likha jata hai. Isme poora Website URL ya Drive Location likhne ki zarurat nahi hoti.
Relative Path ka use tab kiya jata hai jab HTML File aur Image File ek hi Project ya Website Folder ke andar save hoti hain. Ye sabse zyada use hone wala Image Path hai kyunki isse Website ko kisi bhi Server par upload karna aasan ho jata hai.
Example 1: Image Same Folder Me Hai
<img alt="Nature Image" src="nature.jpg" />
Yahan nature.jpg HTML File ke same Folder me save hai, isliye sirf File Name likhna hi kaafi hai.
Example 2: Image Subfolder Me Hai
<img alt="Nature Image" src="images/nature.jpg" />
Yahan nature.jpg images naam ke Folder ke andar save hai, isliye Folder Name ke saath Image Path likha gaya hai.
Absolute Image Path
Absolute Image Path us Path ko kaha jata hai jisme Image ka complete URL diya jata hai. Is Path me Website ka Domain Name aur Image ki poori Location include hoti hai.
Absolute Path ka use tab kiya jata hai jab Image aapke Project Folder me na ho, balki kisi dusri Website, Server ya CDN (Content Delivery Network) par online available ho.
Example
<img alt="Nature Image" src="https://example.com/images/nature.jpg" />
Yahan Browser directly https://example.com Website se nature.jpg Image ko download karke Webpage par display karega.
Advantages of Absolute Image Path
- ✅ Online Images ko directly use kiya ja sakta hai.
- ✅ Image ko Project Folder me save karne ki zarurat nahi hoti.
- ✅ CDN ki Images use karke Loading Speed improve ki ja sakti hai.
Disadvantages of Absolute Image Path
- ❌ Agar Image delete ho jaye ya URL change ho jaye, to Image load nahi hogi.
- ❌ Dusri Website ya Server par dependency rehti hai.
- ❌ Internet Connection ke bina Online Images load nahi hoti.
Difference Between Relative Path and Absolute Path
Relative Path aur Absolute Path dono ka use HTML me Images ko load karne ke liye kiya jata hai. Lekin dono ka working method aur use case alag hota hai. Neeche diye gaye table ki madad se aap in dono ke beech ka difference aasani se samajh sakte hain.
| Relative Path | Absolute Path |
|---|---|
| Current HTML File ke location ke according likha jata hai. | Complete URL ya Full Address likha jata hai. |
| Project Folder ke andar wali Images ke liye use hota hai. | Online Website ya Server ki Images ke liye use hota hai. |
| Chhota aur simple hota hai. | Lamba URL hota hai. |
| Website ko dusre Server par move karna aasan hota hai. | Image dusri Website ya Server par depend karti hai. |
Example: images/logo.png |
Example: https://example.com/images/logo.png |
Common Mistakes While Using HTML Image Path
Beginners aksar HTML Image Path likhte time kuch common mistakes kar dete hain. In mistakes ki wajah se Browser Image ko load nahi kar pata aur Broken Image Icon dikhai dene lagta hai.
In common mistakes ko avoid karke aap apni Images ko bina kisi problem ke Webpage par display kara sakte hain.
1. Wrong File Name
Agar Image ka File Name galat likh diya jaye, to Browser Image ko find nahi kar pata.
❌ Wrong
<img alt="Nature" src="natuer.jpg" />
✅ Correct
<img alt="Nature" src="nature.jpg" />
2. Wrong Folder Name
Folder ka Name galat likhne se bhi Image load nahi hoti.
❌ Wrong
<img alt="Nature" src="image/nature.jpg" />
✅ Correct
<img alt="Nature" src="images/nature.jpg" />
3. Wrong File Extension
Image ki Extension (.jpg, .png, .webp, etc.) bhi sahi honi chahiye.
<img alt="Nature" src="nature.png" />
✅ Correct
<img alt="Nature" src="nature.jpg" />
4. Case Sensitivity
Kuch Servers me File Names case-sensitive hote hain. Isliye Nature.jpg aur nature.jpg alag Files mani ja sakti hain.
Practical Example of HTML Image Path
Ab tak humne Relative Path aur Absolute Path ke baare me seekh liya hai. Ab ek practical example dekhte hain jisse aapko Image Path ka concept aur bhi clearly samajh aa jayega.
Example 1: Relative Image Path
Man lijiye aapke Project ka Folder Structure kuch is tarah hai:
project/
│── index.html
│── images/
└── flower.jpg
Yahan flower.jpg images Folder ke andar save hai. Isliye HTML Code me Relative Path is tarah likha jayega:
<img alt="Flower Image" src="images/flower.jpg" />
Example 2: Absolute Image Path
Agar wahi Image kisi Online Website par available hai, to uska complete URL use kiya jayega.
<img alt="Flower Image" src="https://example.com/images/flower.jpg" />
Yahan Browser directly https://example.com se Image download karke Webpage par display karega.
Conclusion
HTML Image Path Images ko successfully Webpage par display karne ke liye bahut important hota hai. Browser Image ko sirf tabhi load kar pata hai jab src Attribute ke andar diya gaya Path sahi ho.
Is Article me humne HTML Image Path ka concept, iska working process, Relative Path aur Absolute Path ke beech ka difference, practical examples aur common mistakes ko detail me samjha. Ab aap aasani se Local Folder ya Online URL dono se Images ko apni Website me add kar sakte hain.
📌 Summary
- ✅ HTML Image Path Image ki location batata hai.
- ✅ Browser
srcAttribute ke Path ko follow karke Image load karta hai. - ✅ Relative Path Local Project ke liye use hota hai.
- ✅ Absolute Path Online Images ke liye use hota hai.
- ✅ Sahi File Name, Folder Name aur Extension likhna bahut zaruri hai.
- ✅ Galat Path dene par Broken Image Icon dikhai deta hai.
📚 Next Article: Agle Article me hum HTML <picture> Element ko detail me seekhenge. Usme hum <picture> aur <source> Tags ka use, Responsive Images banana aur Different Image Formats ko support karna step by step seekhenge.
🙏 Coding with Sanjay Official के साथ इसी तरह HTML, CSS, JavaScript, PHP, Python और Web Development step by step सीखते रहिए।
हमारा मकसद है कि आप Theory से लेकर Tutorial, Practice, MCQ Quiz और Exam Preparation तक सब कुछ एक ही जगह आसानी से सीख सकें।
📖 Related Articles: अगर आपने अभी तक Responsive Images, HTML Image Source और Image Size से जुड़े Articles नहीं पढ़े हैं, तो इन्हें जरूर पढ़ें।
📚 Helpful Links
🖼️ HTML Responsive Image Attributes
🌐 HTML Responsive Images – Responsive Web Design
📐 HTML Image Size – Width & Height Attributes
🔗 HTML Image Source – Complete Guide
💙 Coding with Sanjay Official – "Coding Ko Aasaan Banayein, Roz Kuch Naya Seekhein!" 🚀
No comments:
Post a Comment