# Adding Custom CSS to Chat Window

### What is Custom CSS?

Custom CSS allows you to apply advanced visual customizations to the **chat window interface** of your AI Agent. It enables precise control over layout, colors, spacing, and other UI elements beyond standard theme settings, helping align the chat experience with your website’s design system.

{% embed url="<https://www.youtube.com/watch?v=vYEddHRltDo>" %}

***

### Benefits of Custom CSS

* 🎨 Enables advanced styling beyond default theme controls
* 🧩 Helps align chat UI with existing website branding
* 🔧 Offers granular control over chat window components
* 🚀 Supports enterprise-level UI customization needs
* 💡 Ideal for teams with frontend or design expertise

***

### How to Use Custom CSS

#### Accessing Custom CSS Settings

1. Log in to your BotPenguin account and select the desired **AI Agent**.
2. Navigate to **“Agent Settings”**.

<figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2FuP5YNSqfEM2uxrvClLu0%2Fimage.png?alt=media&#x26;token=1f32917c-227c-464e-9bd9-14be621d660c" alt=""><figcaption></figcaption></figure>

3. Open the **“Advance”** card.
4. Scroll down to locate **“Custom CSS for Advanced Designs”**.

<figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2F4rvwNQzRRgS5pmVV57Xd%2Fimage.png?alt=media&#x26;token=dfc9d9e2-95a6-443c-9716-d7d5909f73e0" alt=""><figcaption></figcaption></figure>

***

#### Identifying Chat Window Selectors

5. Install the AI Agent chatbot on a test website (for example, using **W3Schools**).
6. Right-click on the chat window and select **“Inspect”**.
7. Use the element selector to identify:
   1. Relevant **class selectors** (`.`)
   2. Relevant **ID selectors** (`#`)

These selectors represent the chat window components you want to customize.

***

#### Writing Custom CSS for the Chat Window

8. Copy the required class or ID from the Inspect panel.
9. Paste it into **Custom CSS for Advanced Designs**.
10. Add your desired CSS properties inside curly braces `{ }`.

**Example:**

```css
#bp-chat-window {
  background-color: #f5f5f5;
}
```

<figure><img src="https://1745791824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAPDb8cKQtGlIAfgHjcsQ%2Fuploads%2Fuv8NgUL0GAbErd1spVjV%2Fimage.png?alt=media&#x26;token=795792e1-6839-4212-ab5a-ce3bbb0dbddd" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
If you want to reduce the extra whitespace that appears between the **right side of the bot message box** and the **right edge of the chat window** (especially on mobile screens), you can use the following CSS. This helps shorten the distance and makes the chat layout look more compact.

Add this CSS to your custom CSS or website stylesheet:

```css
@media screen and (max-width: 600px) {
  #chatWindow {
    min-width: fit-content;
  }
}
```

This CSS ensures that on smaller screens (max-width: 600px), the chat window adjusts its width automatically and removes unnecessary empty space on the right side of bot messages.
{% endhint %}

11. Click **“Save Changes”** to apply the customization.

***

#### Verifying the Changes

12. Refresh the website where the chatbot is installed.
13. Confirm that the chat window reflects the applied styling changes.

🎉 Congratulations, you have successfully completed this section! You're one step closer to mastering BotPenguin.

***

### Custom CSS FAQs

<details>

<summary>What parts of the chatbot can be styled using Custom CSS?</summary>

Custom CSS can be used to style chat window containers, message areas, headers, footers, and other internal UI elements.

</details>

<details>

<summary>Do I need coding knowledge to use Custom CSS?</summary>

Basic CSS knowledge is recommended. For complex designs, a frontend developer should assist.

</details>

<details>

<summary>Will Custom CSS affect the launcher icon?</summary>

No. Launcher icon styling is handled separately using Launcher Icon Custom CSS.

</details>

<details>

<summary>Can incorrect CSS break the chat window?</summary>

Yes. Invalid or conflicting CSS can impact layout or visibility. Always test changes first.

</details>

<details>

<summary>Is Custom CSS applied globally?</summary>

No. It applies only to the specific AI Agent where it is configured.

</details>

***

If you still have questions for our team, write to us at [**support@botpenguin.com**](mailto:support@botpenguin.com). We’ll get back to you within 48 hours.
