--- layout: page title: Transparent background permalink: /guides/styling/transparent-background/ parent: Styling grand_parent: Guides nav_order: 2 description: >- Learn how to create images with transparent backgrounds using the HTML/CSS to Image API. --- # Transparent Backgrounds {: .no_toc } {: .fs-9 } Create images with transparent backgrounds for logos, overlays, and more {: .fs-6 .fw-300 }
## Simplified method (recommended) We've simplified transparent backgrounds. You can now set `transparent_background` to `true` directly on the create image request: ```json { "html": "
Your content here
", "transparent_background": true } ``` The parameter works with both HTML/CSS and URL-based images. For a URL screenshot, replace `html` with `url`. {% include hint.md title="Existing method still supported" text="The CSS-based method documented below still works. You can keep using it with existing integrations, but `transparent_background: true` is the simplest option for new requests." %}
## Implementation To render an image with a transparent background, pass the CSS via the **`css` parameter**: ```json { "html": "
Your content here
", "css": "body { background-color: transparent; }" } ``` {% include hint.md title="Important" text="The transparent background CSS **must** be passed via the `css` parameter. Putting it in a `