---
title: "Add HTML Before the Closing Body Tag"
description: "Customizing your docs with JavaScript snippets and CSS is an awesome way to make them stand out. 🦄"
url: "https://support.helpdocs.io/article/aica06ik1a-add-html-before-the-closing-body-tag"
category: "Code Snippets"
updated_at: "2020-07-06T09:34:22Z"
---

# Add HTML Before the Closing Body Tag

Customizing your docs with JavaScript snippets and CSS is an awesome way to make them stand out.

Most of the time you'll find dropping your custom code into **Settings** &gt; **Code** &gt; **CSS** or **Javascript** works super well by adding code into the `<head>` portion of your knowledge base. But there might be the odd occasion where you'll wanna add a snippet somewhere else. Sometimes scripts *need* to be added before the closing `</body>` tag.

For this you'll wanna use the example below replacing `Your Code` with your custom code and saving the entire snippet into **Settings** &gt; [**Code**](https://my.helpdocs.io/app/settings?tab=code) &gt; **Javascript** 🙃

```javascript
<script>  var someHTML = 'Your Code'; // string of HTML here  ready(function() {    document.body.insertAdjacentHTML('afterend', someHTML);  })  function ready(fn) {    if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){      fn();    } else {      document.addEventListener('DOMContentLoaded', fn);    }  }</script>
```
