Customize the look of the sign-in page
This guide explains how to change the look of the sign-in page of an application: the background image, the style of the sign-in form, its position, and an optional side panel.
Learning outcomes
- Set a background image.
- Style the sign-in form with CSS.
- Position the form and add a side panel.
- Move the design to the same application on another Casdoor instance.
- Know what an organization admin can put in custom HTML and CSS.
What you need
- An application
All settings on this page are on the UI Customization tab of the application edit page. The preview on the tab updates as you change them. This is the result of the steps below:

Set a background image
The default background is white.

-
Set Background URL to the URL of an image. The preview updates when the URL is valid.

-
To use another image on phones, set Background URL Mobile.
-
To use another image when the sign-in page is shown in dark mode, set Background URL Dark.
-
To show a different image now and then, add more images to More background URLs. Each visit to the sign-in page shows one of them or Background URL, picked at random.
On a phone, Background URL Mobile takes precedence over the others. When you apply a theme from the Marketplace, Casdoor saves these settings and restores them when you remove the theme.
Style the sign-in form
-
Enter CSS rules in Custom CSS, for example:
.login-panel{
padding: 40px 30px 0 30px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: 0 0 30px 20px rgba(0, 0, 0, 0.20);
}
-
To use other rules on phones, set Custom CSS Mobile.
Enter plain CSS rules only. Casdoor puts the content of Custom CSS and Custom CSS Mobile into a <style> element itself, so a <style> wrapper of your own breaks the rules.
If Custom CSS is empty, the editor can show a default. To start from it, copy it into the field and save.

The main containers of the form are .login-panel and .login-form. Target them for further changes.
Position the form
In Form position, select Left, Center, or Right.


Add a side panel
-
In Form position, select Enable side panel. The form moves to the center, with a panel beside it.
-
Enter the content of the panel in Side panel HTML. Start from the default template or write your own. Unlike Custom CSS, this field takes HTML, so a
<style>element inside it is fine:<style>
.left-model{
text-align: center;
padding: 30px;
background-color: #8ca0ed;
position: absolute;
transform: none;
width: 100%;
height: 100%;
}
.side-logo{
display: flex;
align-items: center;
}
.side-logo span {
font-family: Montserrat, sans-serif;
font-weight: 900;
font-size: 2.4rem;
line-height: 1.3;
margin-left: 16px;
color: #404040;
}
.img{
max-width: none;
margin: 41px 0 13px;
}
</style>
<div class="left-model">
<span class="side-logo"> <img src="https://cdn.casbin.org/img/casdoor-logo_1185x256.png" alt="Casdoor" style="width: 120px">
<span>SSO</span>
</span>
<div class="img">
<img src="https://cdn.casbin.org/img/casbin.svg" alt="Casdoor"/>
</div>
</div> -
Adjust the form in Custom CSS. Again, enter rules without a
<style>wrapper:.login-panel{
border-radius: 10px;
background-color: #ffffff;
box-shadow: 0 0 30px 20px rgba(0, 0, 0, 0.20);
}
.login-form {
padding: 30px;
}
Move the design to another instance
To move the design of an application to the same application on another Casdoor instance, for example from staging to production, use Export JSON and Import JSON at the bottom of the application edit page. The buttons appear when you edit an existing application.
- On the source instance, click Export JSON. Casdoor copies a JSON document to the clipboard.
- On the target instance, open the same application and click Import JSON.
- Paste the JSON and click OK. Casdoor fills in the fields.
- Click Save.
The JSON contains the name and the organization of the application and the following fields: Logo, Favicon, Background URL and its mobile variant, Custom CSS and its mobile variant, the position and offset of the form, Side panel HTML, the theme, and the header, footer, sign-up, and sign-in HTML. It contains no secrets, providers, or other settings.
The name and the organization in the JSON must match the target application. Otherwise, Casdoor rejects the import. The import moves a design between instances, not between different applications.
What organization admins can put in custom HTML and CSS
Global administrators can save any HTML and CSS. When an organization admin adds or updates an application, in the admin console or through the Casdoor MCP server, Casdoor checks each of these fields that the admin changed:
- Header HTML, Page HTML, Footer HTML, Side panel HTML, Signin HTML, and Signup HTML
- Custom CSS and Custom CSS Mobile
- The Custom CSS of the sign-in items, which custom sign-in items render as HTML
- The Custom CSS of the sign-up items, and the Label of the
Textsign-up items, which Casdoor renders as HTML
Fields that the admin didn't change keep their value, even if it breaks the rules below. If a changed field breaks them, Casdoor rejects the save with an error that names the fields: "the <fields> of the application uses HTML or loads files that this Casdoor only lets a global admin set: ...".
HTML rules
- Only layout and text elements are allowed: for example
div,span,p, headings, lists,a,img, tables,section,detailsandsummary,center,font,style, and basicsvgshapes and gradients.script,form,input,iframe, and other elements are refused, unless a global admin adds them to Allowed custom HTML elements in the global settings.scriptcan't be added; scripts need Enable custom scripts, which only a global admin can turn on. - Event handler attributes (
on...) are refused, as are attributes such assrcset,action,formaction,srcdoc,contenteditable, andxlink:href. hrefis allowed only ona, with a relative URL or anhttp,https,mailto, ortelURL.srcis allowed only onimgand on the elements in Allowed custom HTML elements. Its URL, thedataattribute ofobject, thebackgroundandposterattributes, and anyurl()in an attribute follow the URL rule below.- HTML comments and doctypes are refused.
CSS rules
- The CSS must not contain
\,<,image(,image-set(,cross-fade(,element(, orsrc(. - Every
url()is relative, adata:URL, a#reference, or starts with an allowed prefix. @importis allowed only fromhttps://fonts.googleapis.com/css,https://cdn.jsdelivr.net/npm/@fontsource/, andhttps://cdn.jsdelivr.net/npm/@fontsource-variable/.
The allowed prefixes are:
https://fonts.googleapis.com/andhttps://fonts.gstatic.com/https://cdn.jsdelivr.net/gh/casdoor/,https://cdn.jsdelivr.net/npm/@fontsource/, andhttps://cdn.jsdelivr.net/npm/@fontsource-variable/https://cdn.casbin.org/,https://cdn.casdoor.com/, andhttps://cdn.casvisor.com/- The
originof this Casdoor - The Domain of each Storage provider of the
adminowner - Each entry of Allowed custom HTML URLs in the global settings
- Each entry of
formCssAllowedUrlsinconf/app.conf, a comma-separated list that is empty by default. See Configuration.
A global admin sets both lists on the Global Settings page (/settings), and the change applies to all organizations without a restart.
For example, to let organization admins use background images from your own image host, add https://img.example.com/ to Allowed custom HTML URLs. To let them embed YouTube videos, also add iframe to Allowed custom HTML elements and https://www.youtube.com/embed/ to Allowed custom HTML URLs.
The error of a rejected save names the field and what in it isn't allowed, for example page HTML (<iframe>) or page HTML (the src attribute of <iframe>).
On the sign-in pages, Casdoor also removes scripts from the custom HTML of applications outside the built-in organization. See Custom HTML and scripts.