The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To add an image in an HTML file opened in VS Code, place an <img> element in the page’s <body> and put the image’s URL or file path in src:
<img src="images/photo.jpg" alt="A description of the photo">
Use a path relative to the HTML file for an image in your project, or a complete https:// URL for an image hosted elsewhere. The alt value should describe the image’s meaning; use alt="" when the image is purely decorative. VS Code helps you edit and preview the markup, but the browser resolves the URL and loads the image.
The basic HTML image element
An image is embedded with the void <img> element. It has no closing </img> tag. The essential attributes are:
src: the URL or path of the image resource.alt: a text alternative for people using assistive technology and for cases where the image cannot load.
<img src="images/photo.jpg" alt="A description of the photo">
For example, a simple page might look like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Product photo</title>
</head>
<body>
<h1>Our product</h1>
<img src="images/product.jpg" alt="Front view of the blue product">
</body>
</html>
Replace the example filename and description with your own values. The editor’s syntax highlighting and IntelliSense can help you complete the tag, but they do not upload, copy, or host an image for you.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Choose the correct image source
Local image in your project
Store the file inside the project folder and reference it with a relative path. A common layout is:
my-site/
├── index.html
└── images/
└── photo.jpg
Because index.html is beside the images directory, its element is:
<img src="images/photo.jpg" alt="Description of the photo">
If the image is in the same folder as the HTML file, use only its filename:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →<img src="photo.jpg" alt="Description of the photo">
If the HTML file is in a subfolder, the path starts from that file’s location. For example:
my-site/
├── images/
│ └── photo.jpg
└── pages/
└── about.html
From pages/about.html, the image is one directory up and then in images:
<img src="../images/photo.jpg" alt="Description of the photo">
A relative path is interpreted by the page’s URL or location. VS Code does not repair an incorrect path at runtime, so count the directories from the HTML file you are editing.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Remote image URL
For an image hosted on another server, use its complete URL:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches<img src="https://example.com/images/photo.jpg" alt="Description of the photo">
The address must point to an image resource that the browser can reach. A page URL that merely displays an image is not necessarily the image file itself. Remote hosts can change, remove, or restrict resources, so do not assume an external URL will remain available.
Use external images only when you have permission to use and host them. Avoid hotlinking someone else’s work without permission, and check the image’s license before publishing it. Hosting images in your own project is generally easier to maintain if your site domain changes.
Add the image in VS Code
- Open your project folder in VS Code with File → Open Folder.
- Open the HTML file that should contain the image.
- Place the cursor inside the page’s
<body>, where the image should appear. - Type
imgand use Emmet completion, or enter the full<img>element manually. - Set
srcto the relative path or permitted full URL. - Write useful
alttext, or setalt=""for a decorative image. - Save the file and open the page in VS Code’s Integrated Browser preview.
VS Code’s HTML support includes syntax highlighting, IntelliSense, Emmet, and an Integrated Browser preview. The preview can update as you edit, making it useful for checking both the markup and the resolved image path.
Write useful alternative text
Alternative text should communicate the image’s relevant meaning, not its file name. For an instructional diagram, describe what a reader needs to understand. For a product image, identify the product and important visible detail:
Free tools Windows power users keep installed
One-click scans. No signup required.
<img src="images/blue-chair.jpg" alt="Blue office chair with adjustable arms">
If nearby text already conveys everything the image communicates and the image is only visual decoration, use an empty value:
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
<img src="images/divider.svg" alt="">
Do not omit alt casually. A missing attribute and an intentionally empty attribute communicate different things to assistive technology.
Preview and verify the rendered result
In the Integrated Browser, check that the image appears at the expected size and location. If you are using a development server, open the page through that server rather than relying on a file path copied from another application. The browser resolves a relative URL against the page that is being rendered, so the same markup can work in one folder and fail after the HTML file is moved.
Confirm that the request is for the actual image file, not an HTML error page. A valid-looking URL can still return a missing-resource response, require authentication, or be blocked by the remote host.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWhy an image does not appear
Check spelling, capitalization, and extension
Compare the filename in src with the file on disk character by character. On case-sensitive systems, Photo.jpg and photo.jpg are different names. Also check whether the real extension is .jpeg, .png, .webp, or another format rather than the extension you guessed.
Check the path from the HTML file
Do not calculate the path from the project root unless the HTML file is also at the root. For a page in pages/, use ../ to move up before entering a sibling directory. Moving the HTML file later may require changing its relative paths.
Check the folder location
Make sure the image is inside the project folder that your page can serve. A path to an unrelated location on your computer is not a deployable website URL and normally will not work for visitors.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Check a remote URL directly
Paste the full remote URL into a browser tab. If it does not return the image itself, correct the address or use a permitted local copy. A remote server may block hotlinking, require a login, or have removed the file.
Inspect the element and browser errors
Use the browser’s developer tools to inspect the rendered <img> element and its network request. The request status and resolved URL reveal whether the problem is the markup, the path, or the server response. Fix the first failing part rather than adding random slashes or copying a filesystem path.
Local paths versus full URLs
| Choice | Example | Best fit | Maintenance and permission considerations |
|---|---|---|---|
| Relative local path | images/photo.jpg |
Images packaged with your site | Usually remains easy to move and deploy with the page; you control the file and its license. |
| Full remote URL | https://example.com/images/photo.jpg |
A permitted image that another server intentionally hosts for embedding | Depends on that server’s availability, URL policy, and permission; the address may change or stop allowing requests. |
Relative paths are generally easier to maintain when the site domain changes. If practical, host images used by your site yourself and keep the image files under version control with the rest of the project.
Responsive and advanced markup
For one image URL, src and alt are sufficient. More advanced responsive layouts can add srcset and sizes so the browser chooses among several image files, but those attributes are not required for the basic task:
<img
src="images/photo-800.jpg"
srcset="images/photo-400.jpg 400w, images/photo-800.jpg 800w"
sizes="(max-width: 600px) 100vw, 800px"
alt="Description of the photo">
Add responsive attributes only when you have matching image variants and understand their width descriptors. An incorrect srcset can create a different path problem from the fallback src.
Do not confuse a normal HTML page with an extension webview
The instructions above apply to an ordinary HTML file that you are editing and previewing. A VS Code extension webview is a different environment. Extension authors loading local files into a webview must convert resource URIs with Webview.asWebviewUri. That extension API is not required for a normal website page and should not be added to ordinary HTML just to display a project image.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Deployment and licensing checks
- Keep the image in a path that your deployment process copies to the server.
- Use URL spelling and capitalization that match the deployed files.
- Test the page from the deployed URL, not only from a local preview.
- Retain permission or license information for images you did not create.
- Do not assume that an image found online is free to reuse or that its URL permits embedding.
Or skip the browser setup
If your goal is to obtain a clean image of a web page rather than manually place a project image in HTML, ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one request. Its API accepts the URL, handles the browser capture, and can be used from a script or build process. Documentation and all request options are at https://screenshotneo.com/docs/.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; Growth is $15 for 15,000, Pro is $39 for 60,000, Scale is $99 for 250,000, and Business is $249 for 1,000,000. Yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to try it without a card.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Frequently Asked Questions
Do I need a VS Code extension to add an image URL?
No. VS Code’s built-in HTML support is enough to write an <img> element. The Integrated Browser is useful for previewing it, but the HTML itself does not require an extension.
What happens if I move the HTML file to another folder?
A relative src is resolved from the HTML file’s new location, so you may need to change directory segments such as ../.
Should an image always have descriptive alt text?
Use concise descriptive text when the image conveys information. Use alt="" when it is purely decorative and adds no information.
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.

