Microsoft Technologies based on the .NET software framework. Miscellaneous topics that do not fit into specific categories.
If the wording must remain embedded in a full-width hero image, provide separate desktop and mobile artwork rather than one fixed-size file, with 1600–2400 px-wide desktop, 1024–1600 px-wide tablet, and 640–1080 px-wide mobile versions.
Recommended deliverables
| Use | Suggested pixel size | Format |
|---|---|---|
| Large desktop | 2400 × 1050–1350 | WebP, plus JPEG fallback if required |
| Standard desktop/tablet | 1600 × 700–900 | WebP/JPEG |
| Mobile portrait crop | 800 × 900–1200 | WebP/JPEG |
| Vector-style artwork | Responsive viewBox |
SVG, if fonts are outlined or reliably available |
These dimensions are practical starting points, not .NET requirements. Preserve the same aspect ratio whenever an image is resized; displaying it at a different ratio causes distortion.^1^
Use:
- WebP for most photographic or composited artwork.
- JPEG when the publishing workflow requires broad fallback compatibility.
- SVG only when the hero consists primarily of vector shapes, logos, and typography. Validate and sanitize SVG files before publishing.
- PNG only where lossless detail or transparency is necessary; photographic PNG heroes are usually unnecessarily large.
Keep all wording and logos inside a documented safe area. Do not place essential wording near the edges because a full-width hero commonly needs different crops at different viewport widths. Responsive <picture> sources allow the browser to select different artwork for desktop and mobile.^2^
Important accessibility requirement
Embedding wording in the image is not the preferred implementation. W3C guidance recommends real text instead of images of text because users may need to resize, restyle, translate, or increase the contrast of that text.^3^
If the artwork cannot be changed:
- Include the same wording as accessible HTML text. It can be visually hidden if showing it twice is undesirable.
- Supply meaningful
alttext describing the image and its message. - If the same message is already exposed as HTML immediately beside the image, avoid repeating it in
alt. - Check readability and contrast on every supplied crop.
- Do not rely on embedded text for buttons or links; make the CTA a real HTML element.
Alt text makes image information available to screen readers and also helps search engines understand the image.^4^
Example for an ASP.NET Core .NET 8 site
Place the files under wwwroot/images/hero/, then use responsive Razor/HTML markup:
<picture>
<source media="(max-width: 640px)"
srcset="/images/hero/hero-mobile-800.webp">
<source media="(max-width: 1200px)"
srcset="/images/hero/hero-tablet-1600.webp">
<img src="/images/hero/hero-desktop-2400.webp"
width="2400" height="1050"
alt="The complete message shown in the artwork"
class="hero-image">
</picture>
.hero-image {
display: block;
width: 100%;
height: auto;
}
The explicit width and height reserve the correct aspect ratio, while CSS scales the image to the available width. If the design requires a fixed-height, edge-to-edge crop, create breakpoint-specific artwork instead of depending on object-fit: cover, which can crop embedded wording.
In .NET 8, static assets are normally served from wwwroot through UseStaticFiles.^5^ For a single Razor <img>, asp-append-version="true" can append a content hash so clients reload the file after it changes.^6^
The designer handoff should therefore include three crops, their exact dimensions and safe areas, the accessible wording as plain text, and any required alt-text description—not just one large desktop bitmap.
References
- Displays images with incorrect aspect ratio | Lighthouse | Chrome for Developers
- Using responsive images in HTML - HTML | MDN
- Understanding Success Criterion 1.4.5: Images of Text | WAI | W3C
- Overview: Generate image alt text with Image Analysis
- Serve static files in ASP.NET Core apps
- Image Tag Helper in ASP.NET Core