Link Search Menu Expand Document

Transparent background

Learn how to create images with transparent backgrounds.


How it works

To render an image with a transparent background, include the following in your CSS when generating your image.

body { 
  background-color: transparent;
}

Example

This image has background-color: transparent; set on the body.

HTML/CSS to Image with a transparent background.

Try it yourself


URL Images

When generating an image from a URL. Pass the same CSS in the CSS param and the background will be rendered as transparent.

Works with PNG's only

Transparency is only supported by the PNG file format. By default, all images are rendered as PNG’s. If you render the image as a JPG or Webp, the background will be white.


Need help?

Talk to a human: support@htmlcsstoimage.com. We always respond within 24 hours. And often, even faster.


Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2024 Code Happy, LLC.

Page last modified: Mar 1 2024 at 01:46 AM.

Edit this page on GitHub.