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

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

Focused4ever
Excursionist
51 0 4
Hello All, I just noticed today that I have an error in my Theme.liquid code which is seeming to make other areas in my code also light up in red and underlined. The only changes I made recently were a few verbiage changes on my exit pop up and I added my instagram feed to my homepage using an app called Instafeed by Mintt Studio. I have used it on my home page in the past without problems so I dont think it is either of those 2. I did see something in the code about my mega menus and the container box and also something about photo width and height issues, so I am not sure if it has anything to do with that? My website seems to be working just fine though. The actual error I am getting when I hover over the code is Attempting to close HtmlElement 'div' before HtmlElement 'body' was closed (see attached screenshot)
I am hoping someone can help me with this. I dont know a lot about code just enough to navigate it really. But not specifics.  I have attached a few screenshots with as many notes as I could make to help make it as easy for someone to help diagnose my problem here. The only other time I have seen something like this was on a friend of mine website, he said it ended up being one tiny little thing that had changed in an app by the developers of the app that it started throwing code on him in the back end. Not sure if this is my issue but any help would be appreciated. My store name is focalimagedesigns.net. My site is not live yet so if anyone needs the PW to enter please private message me. Also I apologize for image quality, for some reason they dont upload correct and get all blurry. Thanks

MAIN CODE ERROR AND THEME 1.JPG

HEADER LIQUID ERROR.JPG

 
<body class="{% if template == '404' %}error-404{% else %}{{ template | replace: '.', '-' | handle }}{% endif %}"
    data-money-format="{{ shop.money_format }}" data-shop-url="{{ shop.url }}">
 
    {% section 'header' %}
 
    <div class="mega-menu-container">
      {% if settings.mega_menu_1 %}
        {% section 'mega-menu-1' %}
      {% endif %}
 
      {% if settings.mega_menu_2 %}
        {% section 'mega-menu-2' %}
      {% endif %}
 
      {% if settings.mega_menu_3 %}
        {% section 'mega-menu-3' %}
      {% endif %}
 
      {% if settings.mega_menu_4 %}
        {% section 'mega-menu-4' %}
      {% endif %}
 
      {% if settings.mega_menu_5 %}
        {% section 'mega-menu-5' %}
      {% endif %}
 
    </div>
 
    {% unless feature_image %}
      <div class="container main content">
    {% endunless %}
 
      {{ content_for_layout }}
 
<script class="endOfLayoutContentX" type="text/mark"></script>
    </div>
Replies 4 (4)

ThePrimeWeb
Shopify Partner
2138 616 503

Hey @Focused4ever,

 

 

Can you close the cart__item div in between the </div> and </a>. The inner div is closed but the outer one isn't

ThePrimeWeb_0-1707365376425.png

 

Was I helpful?

Buy me a coffee

🙂

Need help with your store? contact@theprimeweb.com or check out the website
Check out our interview with Shopify!
Focused4ever
Excursionist
51 0 4

Hi There, Thanks for your reply. I tried said solution and then the same exact thing happened to the code below it. Smae Error and everything and it kept happening all the way down that page. But then also I started getting errors in other places in the code and then when I would fix them others would pop up and over and over and it was crazy. I am not sure what is going on. I am attaching below some of the different errors I started getting after trying to repair the first one the way you told me to. Maybe these can tell you something more. I keep seeing something saying missing width and height. And again my website seems to be working just fine. That is what is throwing me. Any other info you can provide would be helpful. Thanks

MAIN CODE ERROR AND THEME 1.JPG

HEADER LIQUID ERROR.JPG

ThePrimeWeb
Shopify Partner
2138 616 503

Hey @Focused4ever

 

Honestly, it's harder to fix without seeing the full code. The missing height and width is just a warning, It will work with or without it anyway. 

 

For the header, I see the closing </a> tag but I don't see an opening <a> tag, so the screenshot is not really giving me good info, sorry.

Was I helpful?

Buy me a coffee

🙂

Need help with your store? contact@theprimeweb.com or check out the website
Check out our interview with Shopify!
imrangr8
Visitor
1 0 0

i have the same problem but i can see that div is closed in the next few lines as he didn't post the whole code

Capture.PNG