Unlayer Examples
Documentation

Custom CSS

In this example, we will add custom CSS to the editor and modify some styling for the canvas. You can visit the documentation for more options.

We'll first create a custom.css file that adds a yellow border to the canvas.

custom.css

.blockbuilder-preview {
  background-color: yellow;
  background-image: none;
}

Now, we'll pass the custom.css URL to the editor in init option customCSS.

  • The URL must be absolute
  • You can load multiple URLs by passing more in the array
  • If you don't have the option to pass a URL, you can directly pass your CSS code as a string
unlayer.init({
  id: 'editor-container',
  displayMode: 'email',
  customCSS: ['https://examples.unlayer.com/examples/custom-css/custom.css'],
});

Preview