# HTML Error: should not contain div elements

**URL:** https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250
**Category:** Questions
**Created:** [November 29, 2025, 6:24pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250 "2025-11-29T18:24:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![iamliving](https://avatars.discourse-cdn.com/v4/letter/i/eb9ed0/32.png) [@iamliving](https://forum.pinegrow.com/u/iamliving)
#### Post date: [November 29, 2025, 6:24pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/1 "2025-11-29T18:24:41Z")

</div>

I’m building out my website and ever time I open my homepage I get the following error message:

HTML - should not contain div elements.

I’m using Bootstrap 5 and was unaware that HTML can not contain div elements? 🙂

Any assistance would be helpful.

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [November 29, 2025, 9:49pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/2 "2025-11-29T21:49:42Z")

</div>

Welcome to Pinegrow! Can you share a screenshot of your error & page tree. For eg, a div tag is not allowed within a p tag, its html rules.

---

<div class="post-metadata">

### Author: ![PeteSharp](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/petesharp/32/7073_2.png) [@PeteSharp](https://forum.pinegrow.com/u/PeteSharp)
#### Post date: [November 29, 2025, 11:26pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/3 "2025-11-29T23:26:13Z")

</div>

If you run the Page → Check for HTML errors, Pinegrow will show you where the invalid markup is.

Here is an example in one of my Bootstrap projects… funny enough AI built this section 😆  
The issue in this case, is a button must only contain inline content like text, span etc, a div is not valid, same as what @TechAkayy mentioned above.

 ![CleanShot 2025-11-30 at 12.20.15@2x](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/9f4bb4ff3bc08d266e72e2c57db3a1cc3e168107.png)

---

<div class="post-metadata">

### Author: ![AllMediaLab](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/allmedialab/32/2079_2.png) [@AllMediaLab](https://forum.pinegrow.com/u/AllMediaLab)
#### Post date: [November 30, 2025, 2:16pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/4 "2025-11-30T14:16:12Z")

</div>

@iamliving Hi,

> [@iamliving](#):
>
> I’m using Bootstrap 5 and was unaware that HTML can not contain div elements?

Yes as long if your div is nested in the body tag! And not nested in html tag without the body tag!

David

---

<div class="post-metadata">

### Author: ![jefferis](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/jefferis/32/503_2.png) [@jefferis](https://forum.pinegrow.com/u/jefferis)
#### Post date: [December 5, 2025, 5:43pm UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/5 "2025-12-05T17:43:07Z")

</div>

I am getting this error too but idon’t have any divs in the html header

---

<div class="post-metadata">

### Author: ![PeteSharp](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/petesharp/32/7073_2.png) [@PeteSharp](https://forum.pinegrow.com/u/PeteSharp)
#### Post date: [December 8, 2025, 4:39am UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/6 "2025-12-08T04:39:11Z")

</div>

Use the Check HTML tool, to find the markup causing the problem. As above.

---

<div class="post-metadata">

### Author: ![jefferis](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/jefferis/32/503_2.png) [@jefferis](https://forum.pinegrow.com/u/jefferis)
#### Post date: [December 10, 2025, 2:54am UTC](https://forum.pinegrow.com/t/html-error-should-not-contain-div-elements/11250/7 "2025-12-10T02:54:15Z")

</div>

the problem was the lack of a body closing tag, which I added, but when I did, it removed the closing html tag and I could NOT add the close tag as it would not save.
