Images Added Using the CSS Background-Image Property

Images Added Using the CSS Background-Image Property

WCAG Focus: WCAG 1.1.1 (A)

WordPress hero sections, feature cards, and team profiles often render photos using inline CSS style="background-image: url(…)" on an empty <div>. Because CSS backgrounds carry no alt attribute and disappear automatically in Windows High Contrast / Forced Colors mode, meaningful visual content vanishes for assistive tech and low-vision users.

Why This Pattern Violates WCAG

WCAG 1.1.1 Non-text Content (Level A) and Failure F3 explicitly state that informative images inserted via CSS background properties fail compliance because they cannot expose programmatic text alternatives.

Code Comparison

Inaccessible Meaningful Background Image

<div class="promo-banner" style="background-image: url('/sale-details.jpg'); height: 300px;"></div>

Compliant Semantic Image Element

<img src="/sale-details.jpg" alt="Summer workshop schedule: June 12 to June 14" style="width:100%;height:auto;">

How to Fix It in WordPress

  • Reserve CSS background-image strictly for pure decoration.
  • Use an <img> element with alt text and object-fit: cover for any photo, chart, or graphic containing information.

Finding This Issue Automatically

Page builders love converting standard photos into CSS background-image blocks on empty <div> containers. The WP ADA Compliance Check plugin alerts you when CSS background images are used in content blocks, helping you verify whether meaningful visuals need real <img> markup.

WCAG References & Supporting Materials

WCAG Success Criteria

Supporting Documentation & Guides

Subscribe

Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

Cart Accessibility Tools
hide