CODE ERROR: Attempting to close HtmlElement 'div' before HtmlElement 'body' was closed

Topic summary

A Shopify theme developer is encountering HTML validation errors in their theme.liquid file, specifically “Attempting to close HtmlElement ‘div’ before HtmlElement ‘body’ was closed.” The website appears to function normally despite the errors.

Recent Changes:

  • Minor text edits to exit popup
  • Added Instafeed app (previously used without issues)

Troubleshooting Attempts:

  • Initial suggestion was to close a cart__item div tag in a specific location
  • Fixing one error caused cascading errors throughout the code
  • Additional warnings appeared about missing image width/height attributes

Current Status:

  • Multiple validation errors persist across different sections
  • Screenshots provided show reversed/garbled code text, making remote diagnosis difficult
  • One commenter reports experiencing the same issue and notes the div appears properly closed in subsequent lines
  • The helper acknowledges that without access to the full code, providing accurate fixes is challenging
  • Missing height/width attributes are noted as warnings that won’t break functionality

The issue remains unresolved, with the primary obstacle being the inability to review complete code context.

Summarized with AI on November 8. AI used: claude-sonnet-4-5-20250929.

Hey @Focused4ever ,

Can you close the cart__item div in between the and . The inner div is closed but the outer one isn’t