Use an <img> element whose src points to the PNG file or URL:
<img src="images/example.png" alt="Description of the image">
Put the file where that path resolves from the HTML document, match the filename and capitalization exactly, and write alt text that explains the image’s purpose. The sections below cover dimensions, responsive variants, accessibility, deployment checks, and common failures.
The standard way to embed one PNG
For a single image resource, HTML’s standard method is the img element with a src attribute. The value of src is a resource URL, not a description page or a directory.
<img src="images/example.png" alt="A blue mountain logo">
This example assumes the HTML file is in a directory whose child folder is named images, and that the file is named example.png. The browser requests that image when it parses the element.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#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
Use a relative path
A relative URL is resolved from the location of the HTML document. If about.html is at /docs/about.html and the image is at /docs/images/team.png, use:
<img src="images/team.png" alt="Our support team">
If the image is one directory above the document, use ../:
<img src="../images/team.png" alt="Product diagram">
For an image hosted elsewhere, use its complete HTTPS URL:
<img src="https://cdn.example.com/assets/example.png" alt="Example chart">
Prefer HTTPS when the page itself is delivered over HTTPS; a non-secure image can be blocked as mixed content.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use the exact file name
Web servers commonly treat uppercase and lowercase as different characters. Example.png, example.png, and example.PNG may therefore be different paths. Check the extension as well as every folder name. A path that works on a case-insensitive local computer can fail after deployment to a case-sensitive server.
Write useful, accessible alt text
The alt attribute is replacement text. It can be shown when the image cannot load and is read by assistive technology. Describe the information the image contributes, not every visual detail.
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
Informative images
<img src="images/sales-growth.png" alt="Sales increased from January through June">
If the surrounding text already states the same information, keep the alternative concise. Do not begin with “image of” or “picture of”; the element is already exposed as an image.
Decorative images
When an image adds no information—for example, a purely ornamental divider—use an empty value:
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 →<img src="images/divider.png" alt="">
Keep the alt attribute present. Omitting it can cause inconsistent results for screen-reader users.
Images that are also links
Describe the destination or action when the image is the link’s meaningful content:
<a href="/pricing.html">
<img src="images/pricing-badge.png" alt="View pricing">
</a>
Add intrinsic dimensions when you know them
Set the PNG’s intrinsic pixel dimensions with HTML width and height attributes:
<img src="images/hero.png" alt="Dashboard overview" width="1600" height="900">
These attributes let the browser reserve the correct aspect-ratio space before the file arrives, reducing layout movement. They are not a command to stretch the bitmap to a particular visual size in every layout.
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.
Use CSS for display sizing
Apply CSS when the image must fit a layout or resize fluidly:
.hero {
display: block;
max-width: 100%;
height: auto;
}
The HTML dimensions preserve the source ratio; max-width: 100% prevents overflow in a narrow container, and height: auto keeps the ratio while the rendered width changes.
Choose responsive markup only when you have alternatives
A single PNG needs only img. Add responsive markup when you have multiple files or need different art direction.
Select a size with srcset and sizes
Use width descriptors when the same image is available at several resolutions:
Outdated 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 matchPC 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 & 11<img
src="images/photo-800.png"
srcset="images/photo-400.png 400w,
images/photo-800.png 800w,
images/photo-1600.png 1600w"
sizes="(max-width: 600px) 100vw, 800px"
width="1600"
height="1000"
alt="A coastal trail at sunset">
srcset lists candidates. The sizes value tells the browser how wide the image will render in each viewport condition, allowing it to choose an appropriate file. Keep the ordinary src as a fallback.
Use picture for art direction or format choices
Use picture when the crop or source should change at a breakpoint, or when you want to offer alternate formats while retaining a fallback:
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
<picture>
<source media="(max-width: 600px)" srcset="images/portrait-mobile.png">
<source type="image/webp" srcset="images/portrait.webp">
<img src="images/portrait.png" width="1200" height="900" alt="Portrait of the speaker">
</picture>
The nested img remains the fallback and supplies the alternative text. Use srcset/sizes for resolution and slot selection; use picture/source for media-conditioned crops or format alternatives.
A complete minimal page
This document demonstrates a predictable project layout and a responsive image:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PNG example</title>
<style>
.content-image { display: block; max-width: 100%; height: auto; }
</style>
</head>
<body>
<main>
<h1>Product overview</h1>
<img class="content-image"
src="images/product.png"
width="1200"
height="800"
alt="Product dashboard showing monthly usage">
</main>
</body>
</html>
Save the HTML file and images/product.png in the locations represented by the path, then serve the directory through your normal web server. A local file may appear to work while a deployed path fails, so verify the published URL too.
When the PNG does not appear
- Check the requested URL. Make sure
srcnames the image file itself, not a folder or an HTML page that describes it. - Resolve the path from the document. Count directories from the HTML file’s URL, and add or remove
../as needed. - Match spelling and case. Confirm every directory, base name, and extension, including capitalization.
- Confirm deployment. Open the image URL directly in a new tab in the same environment where the page is served. If it is not present there, upload or deploy it to that location.
- Inspect the browser network panel. Reload the page, select the failed image request, and read its status. A 404 usually indicates a wrong path; a 403 indicates access controls; a redirect may indicate the URL is not the image endpoint.
- Validate the file. A truncated or corrupted PNG, invalid metadata, empty
src/srcset, or an unsupported image format can trigger an image-loading error. Replace the file with a known-good PNG and test again. - Check protocol and policy. An HTTP image on an HTTPS page can be blocked as mixed content. Cross-origin restrictions, authentication, or a restrictive content-security policy can also prevent a remote resource from loading; inspect the console for the specific message.
Why a broken-image icon appears
A broken icon means the browser could not decode or retrieve the selected resource. Start with the network request URL rather than changing CSS. If the request succeeds but decoding fails, regenerate or re-export the PNG and confirm that the response is actually an image rather than an error document.
Why the image is the wrong size
Check whether CSS sets a fixed width and height, whether the source file’s intrinsic ratio differs from the values in HTML, and whether a srcset candidate is being selected intentionally. Keep the ratio by setting one CSS dimension to auto and ensure the declared intrinsic dimensions match the file.
Or skip the browser setup
If you need a clean image of a web page rather than embedding an existing PNG, ScreenshotNeo returns a screenshot or PDF from one request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; 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 page verdict and billing status in X-Page-Verdict and X-Billed headers.
Recommended Free Tools
Use the API documentation at https://screenshotneo.com/docs/ for all options. This call saves a WebP 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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.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://example.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://example.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 with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. It includes full-page capture with lazy-image loading, CSS-selector element capture, device presets or custom viewports, retina scale, PDF controls, custom CSS and JavaScript, click and wait actions, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.
The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan. Create a free ScreenshotNeo account.
Performance and reliability considerations
- Declare intrinsic dimensions so layout space is reserved before a PNG finishes downloading.
- Use appropriately sized files and
srcsetwhen several resolutions exist; sending a very large bitmap to a small slot wastes bandwidth. - Keep the fallback
srcvalid even when using responsive sources. - Test the deployed URL, not only a local file path, because directory roots, case sensitivity, authentication, and redirects can differ.
- For generated screenshots, choose caching and wait settings deliberately: dynamic pages may need a selector, delay, or network-idle wait, while static pages benefit from a reusable cache TTL.
Quick reference
| Need | Use | Key detail |
|---|---|---|
| One PNG | img src |
Point directly to the resource URL. |
| Accessible meaning | alt |
Describe the image’s purpose; use alt="" when decorative. |
| Reserve layout space | width and height |
Use the source’s intrinsic pixel dimensions. |
| Fluid display | CSS | max-width:100%; height:auto is a common constraint. |
| Several resolutions | srcset and sizes |
Let the browser choose by slot width and density. |
| Different crops or formats | picture and source |
Keep an img fallback. |
Frequently Asked Questions
Can I put a PNG directly in the HTML instead of using a separate file?
Yes, but that uses a data URL rather than the ordinary file-based src pattern. For maintainability and caching, a normal PNG URL is usually simpler.
Does the PNG have to be in an images folder?
No. The folder name is arbitrary; only the URL resolved from the document location must match the deployed file.
Should I use width and height when CSS already sets dimensions?
Yes, when the intrinsic dimensions are known. HTML dimensions communicate the ratio early, while CSS controls the final layout size.
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.

