Put the image in a folder that is reachable from your HTML file, then use that folder’s URL-relative path in the src attribute:
<img src="images/photo.jpg" alt="Description of the photo">
If index.html and an images folder are siblings, images/photo.jpg is the correct path. The path is resolved from the HTML document’s URL, not from a personal computer’s filesystem.
Use a URL-relative path, not a computer file path
HTML’s <img> element embeds an image at the URL supplied by src. The element is a void element, so it does not need a closing tag. Always provide meaningful alt text for accessibility and as a fallback when the image cannot load.
For a simple project, arrange the files like this:
website/
├── index.html
└── images/
└── photo.jpg
Then reference the image from index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Photo</title>
</head>
<body>
<img src="images/photo.jpg" alt="A description of the photo" width="800" height="600">
</body>
</html>
src="images/photo.jpg" means “look for an images directory relative to the URL of this HTML document, then request photo.jpg.” It does not mean “look in any folder named images on my computer.”
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Model: Dell OptiPlex 7050 Small Form Factor (SFF)
- Processor: Intel Core i7-7700 3.60 GHz
- Memory: 32GB DDR4 Ram
- Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
- Operating System: Windows 11 Pro (64-bit)
Choose the right path for your folder layout
Image in a child folder
When the image folder is inside the directory containing the HTML file, name the child folder directly:
<img src="images/photo.jpg" alt="Mountain at sunrise">
Image in the same folder
If the image sits beside the HTML file, omit the folder:
<img src="photo.jpg" alt="Mountain at sunrise">
Image in a parent-level folder
For an HTML file in a subfolder and an image folder in the project root, use ../ once for each directory level you must leave:
website/
├── images/
│ └── photo.jpg
└── pages/
└── about.html
<img src="../images/photo.jpg" alt="Mountain at sunrise">
From pages/about.html, .. means the website directory. If the file were two levels deep, such as pages/company/team.html, the path would be ../../images/photo.jpg.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Absolute URL on a website
You can use a complete URL when the image is hosted elsewhere or on a separate image server:
Rank #2
- AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
- FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
- FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
- UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
- A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.
<img src="https://example.com/assets/photo.jpg" alt="Mountain at sunrise">
Relative URLs are generally easier to maintain when a domain changes. On a live site, the image can be served by the same host as the HTML or by a CDN; what matters is that the URL in src resolves to the deployed image.
Make the image accessible and prevent layout shifts
Write useful alt text
alt should describe the image’s purpose. For example, use alt="A red bicycle leaning against a brick wall" rather than alt="image". Screen readers announce this text, and browsers can show it when the image request fails. If an image is purely decorative and conveys no information, an empty attribute (alt="") tells assistive technology to skip it.
Declare dimensions when known
Adding width and height lets the browser reserve space before the file arrives:
Free tools Windows power users keep installed
One-click scans. No signup required.
<img src="images/photo.jpg" alt="A red bicycle leaning against a brick wall" width="1200" height="800">
These attributes describe the image’s intrinsic dimensions; CSS can still control its displayed size. A common responsive rule is:
img {
max-width: 100%;
height: auto;
}
Without dimensions, the browser may initially render the surrounding HTML and then move content when the image arrives. MDN notes that the browser updates the page as the image is received, so reserving space improves visual stability.
Rank #3
- Performance: Powered by Intel Celeron N4500 dual-core processor with up to 2.8 GHz burst frequency and 4MB L3 cache, this HP Chromebook delivers smooth multitasking for everyday computing. With 4GB LPDDR4x-2933 RAM and Intel UHD Graphics, enjoy seamless web browsing, video streaming, and productivity apps. Chrome OS boots in seconds and updates automatically, keeping your laptop secure and running at peak performance for students, professionals, and home users.
- Immersive 14-Inch HD Display: Experience clear, vibrant visuals on the 14-inch diagonal HD (1366 x 768) anti-glare display with 250 nits brightness and 62.5% sRGB color accuracy. The micro-edge design maximizes your viewing area with an impressive 80% screen-to-body ratio, perfect for streaming movies, video calls, and document editing. The anti-glare coating reduces eye strain during extended use, making it ideal for all-day productivity and entertainment in any lighting condition.
- Advanced Connectivity & Ports: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.3 for seamless device pairing. Equipped with versatile ports including 1 USB Type-C 10Gbps (with USB Power Delivery and DisplayPort 1.4), 2 USB Type-A 5Gbps ports, 1 HDMI 1.4b, and 1 headphone/microphone combo jack. Connect external monitors, transfer files quickly, charge your device, and expand your workspace effortlessly for maximum productivity and flexibility.
- All-Day Battery & Premium Design: The battery keeps you powered throughout your day, while the included 45W USB Type-C power adapter ensures fast charging. Featuring a sleek modern grey finish with vertical brushing pattern on the keyboard deck, this lightweight 3.35 lb Chromebook combines style and portability. The full-size modern grey keyboard and HP Imagepad provide comfortable typing and precise navigation for work, school, or entertainment on the go.
- Enhanced Security & Multimedia: Built-in H1 secure microcontroller protects your data and privacy with enterprise-grade security. The HP True Vision 720p HD camera with integrated dual array digital microphones delivers crystal-clear video calls and online meetings. HD Audio with stereo speakers provides rich, immersive sound for music, videos, and calls. With 64GB eMMC storage, you have ample space for essential files while Chrome OS seamlessly integrates with Google Drive for cloud storage.
Check names, extensions, and capitalization
The URL must match the deployed file exactly. Confirm all of the following:
- The file is actually inside the folder named in
src. - The spelling, capitalization, hyphens, spaces, and extension match.
- The real format is what the name claims:
.jpg,.jpeg,.png,.gif, or.webp, for example. - The hosting system preserves the same case as the URL. A file named
Photo.JPGis not necessarily the same asphoto.jpgon a case-sensitive server.
Do not use a Windows path such as C:UsersAlexPicturesphoto.jpg in a deployed page. Browsers need a web URL, such as images/photo.jpg or /images/photo.jpg, exposed by your server.
Relative versus root-relative paths
A path without a leading slash is relative to the current HTML document:
<img src="images/photo.jpg" alt="...">
A leading slash starts at the website’s domain root:
<img src="/images/photo.jpg" alt="...">
Root-relative URLs can be convenient when every page uses one site-wide assets directory, but they depend on the domain root and application deployment. Use the form that matches your hosting layout. If your site is published under a subdirectory, such as https://example.com/docs/, a root-relative /images/photo.jpg points to https://example.com/images/photo.jpg, not necessarily to https://example.com/docs/images/photo.jpg.
Rank #4
- [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
- [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
- [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
- [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
- [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
Debug an image that does not appear
- Inspect the generated HTML. Verify that the browser receives the expected
src, with no accidental spaces or missing quotation marks. - Count directory levels. Start at the HTML file’s directory. Add one
../for every level you move upward, then add the image folder and filename. - Open the image URL directly. Copy the resolved URL into a browser tab. A missing-file response confirms a path or deployment problem rather than an HTML layout problem.
- Check the browser’s Network panel. Reload the page and inspect the image request. A 404 usually means the URL does not map to a deployed file; a 403 indicates a permission or access rule; a successful response with a broken display can indicate an invalid or mislabeled image file.
- Compare local and deployed paths. A development server may serve files from a different base URL than production. Test the actual published URL, not only a local file opened with a
file://address. - Check case and extension. Rename the URL or file so both use the same exact capitalization and extension.
- Look for encoding issues. Prefer simple filenames such as
team-photo.webp. If a filename contains spaces or non-ASCII characters, the server and URL must encode them consistently. - Confirm the file is included in deployment. Build tools, ignore files, and upload filters can leave an image out even though it exists in your working directory.
Use responsive and modern image variants when needed
For one image, src is sufficient. For different screen sizes, add srcset and sizes so the browser can choose an appropriate file:
<img
src="images/photo-800.jpg"
srcset="images/photo-400.jpg 400w, images/photo-800.jpg 800w, images/photo-1600.jpg 1600w"
sizes="(max-width: 600px) 100vw, 800px"
alt="A mountain at sunrise"
width="1600"
height="1067">
Every candidate still needs a valid URL relative to the HTML document. Keep the fallback src for browsers that do not use the responsive attributes.
Or skip the browser setup
If your goal is to obtain a clean image of a page rather than hand-code an <img> reference, ScreenshotNeo can capture a URL with one request. It accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.
See the complete parameter list in the ScreenshotNeo documentation. A cURL request that saves a WebP image is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
And in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));
ScreenshotNeo also provides an MCP server for AI agents, including Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. Its free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.
Hosting and deployment considerations
Keep image paths consistent between your source tree and the deployed site. If your HTML is generated into a different output directory, calculate the path from that output location, not from the source template. A CDN can serve the same files from another hostname; in that case, use the CDN URL or configure your site so the relative URL maps to the CDN as intended. Test at least one production URL after every path or build-system change.
Best Value
- 🖥POWERFUL PROCESSOR and SUPERIOR STORAGE: Configured with top of the Intel Core i5 processor for lightning-fast, reliable and consistent performance to ensure an exceptional PC experience. 16GB RAM memory to smoothly run multiple applications and browser tabs all at once. 2TB HDD storage space to store apps, games, photos, music, and movies. Loaded with 16GB to zip through multiple tasks in a hurry without lag.
- 🖥️New 22 Inch Full HD (1920x1080) LED monitor: with 75hz, High-Quality panel with quick refresh rate and response time. With 1080p resolution, you can enjoy gaming or a modern computing experience. 22 Inch monitor has a Smart Contrast to provide optimized image quality. Bezel-less and sleek design with glossy finish, crisp edge-to-edge visuals. Wide Viewing Angles for clarity from any viewpoint. VESA Mountable and built-in tilt options allow for a variety of monitor configurations.
- ⌨️ +🖱️ RGB KEYBOARD AND MOUSE | RGB SPEAKER: 3 LED Colors - Blue, red, green, Backlight LED Lights for use at night time, looks amazing. The keyboard mouse and speaker are responsive, reliable, and probably plastered in RGB lights. It's important you pick the right one for your desktop.
- 💿 WINDOWS 10 Pro LATEST: A new installation of the latest Microsoft Windows 11 Professional 64 Bit Operating System software, free of bloatware commonly installed from other manufacturers. As Microsoft's latest and best OS to date, Windows 10 Pro 64 Bit will maximize the utility of each PC for years to come. Optional software such as Anti-Virus and Office 365 can also be easily downloaded through the Microsoft Windows App Store.
Frequently asked questions
Can I put an image in a folder outside my website?
Not by referring to an arbitrary local folder in published HTML. Copy the asset into a directory served by your site or use an accessible HTTPS URL.
Should I use a leading slash?
Only when you want a URL rooted at the domain. For pages deployed under a subdirectory, a document-relative path often avoids pointing at the wrong location.
Why does the image work locally but fail online?
Production commonly exposes a different base directory, omits untracked files, or treats capitalization differently. Open the production image URL directly and inspect its network response to identify which condition applies.
Frequently Asked Questions
What is the shortest correct image tag?
<img src="images/photo.jpg" alt="Description of the photo">, assuming the image is in an images folder beside the HTML file.
How many ../ segments do I need?
Use one for each directory level you move upward from the HTML file’s directory before entering the image folder.
Do image URLs include the computer’s drive letter?
No. Published HTML uses a web URL path, never a local Windows or macOS filesystem path.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools

