Automatically created card using media image #2.
Automatically created card using media image #3.
Automatically created card using media image #4.
The hero image above is rendered using the <responsive-image> tag helper:
<responsive-image
image="@Model.HeroImage"
alt="Hero image demonstrating responsive crops"
class="hero-image"
loading="eager"
decoding="async" />
The tag helper generates a <picture> element with multiple <source> elements for different breakpoints:
Aspect Ratio: 4:3 (Portrait-friendly)
Range: 0-767px
Devices: Phones in portrait/landscape
Taller crop optimized for vertical viewports
Aspect Ratio: 16:9 (Standard widescreen)
Range: 768-1365px
Devices: All tablets including iPad Pro 12.9"
Classic widescreen for tablet experiences
Aspect Ratio: 2:1 (Modern wide hero)
Range: 1366px+
Devices: Laptops and desktop monitors
Wide but balanced crop for large screens
The StartPage demonstrates both direct attributes and block-based setup:
// Hero image: explicit per-property aspect ratios
[AspectRatio(Breakpoint.Mobile, 4, 3)]
[AspectRatio(Breakpoint.Tablet, 16, 9)]
[AspectRatio(Breakpoint.Desktop, 2, 1)]
public virtual ResponsiveImage HeroImage { get; set; }
// Cards: content area with CardBlock items
[AllowedTypes(typeof(CardBlock))]
public virtual ContentArea CardBlocks { get; set; }
CardBlock.Image to reuse the named card templateCardBlock items onlyTo test the responsive hero behavior:
HeroImage and CardBlocks and save to verify persisted rendering