How to change background color of jQuery UI Dialog?

I am having tough time figure out how to change background color of jQuery UI Dialog.

I've seen many reference how to change/remove title bar but not entire background including those curvy corner.

Here is my try:

The problem is .ui-widget-content only applies to square area within the dialog but not including curvy corner.

I found a class .ui-corner-all class hoping it will color the entire background but only half of the dialog is colored. (you can see this in the jsfiddle)

Has anyone done this before?


you can use this way

You should set to all class background with use !important.

.ui-dialog,.ui-widget, .ui-widget-content, .ui-corner-all, .foo, .ui-draggable, .ui-resizable {background:yellow !important}‚Äč

Use the css classes:

  • ui-dialog
    • Main container of whole thing
  • ui-dialog-title
    • This is where the title actually appears
  • ui-dialog-titlebar
    • Area where title of dialog would be if exist
  • ui-dialog-content
    • Area where your div is actually loaded
  • ui-resizable-handle
    • These divs are used to resize the dialog but are usually invisble according to your setup
  • ui-dialog-buttonpane
    • Here is where buttons would go if exist
  • ui-dialog-buttonset
    • This is where the buttons actually appear

Also, unlike answer given selected, take note, YOU DON'T HAVE TO USE !important.

If you want a direct call, set everything up and create your dialog. Load the page in Chrome or FF (chrome easier to read). Then simply open the dialog and select the element you want to change. Look at its CSS in your Browser's Developer Tools. You'll be able to see the exact line jqueryui uses to make it's css call. Simply copy that line into your own CSS and ensure it's loaded later and your dialog will get the new overwrite.

Use this class in css

.ui-dialog .ui-dialog-content {
    border: 0;
    padding: .5em 1em;
    background: #ff0000;
    overflow: auto;
    zoom: 1;

Please be aware that you could also go and make your own custom CSS using this link in jQuery

jQuery allows us to make a custom-css. Please select the theme you would want from the gallery and hit the edit button, you will be able to change almost everything about the dialog box, as well as the rounded corners.

You then need to download the entire jQuery pack within it you will find css/custom-css folder just put in your css tag and it will be all sorted basically.

The above ways are also true as you will be able to change it but you will have to look for the classes and stuff like that in the CSS well jQuery does that for us in an easy way and it worked for me as well so you can try it too.

What I basically do is create two to three custom style sheets and then load them up and play with them and finally choose one for the website and discard the rest.

I hope this helps...

If you want to target a specific dialog you can do it this way:

    autoOpen: false,
    open: function(e) {

Short answer


.ui-widget-content { background: yellow; }

Make sure your stylesheet is included after the JQuery UI stylesheet, e.g.


    <link rel="stylesheet" type="text/css" href="">
    <link href="your_stylesheet.css" rel="stylesheet" type="text/css"></link>

Long answer

To determine which class and style to override, you will need to inspect a tooltip. Show the tooltip:


Right-click on the tooltip and choose "inspect". Scroll down in the "Styles" tab until you find the attribute you care about (background-color).

You can click on the value and type in a new value to verify that it will have the effect you desire.

To see the format you will need to use to override the format, click on the filename:line # on the upper-right to go to the .css file that defines the attribute (jquery-ui.css:802)

The format will be

    background: yellow;

Your .css file needs to use the same style and be included after this one (see "short answer", above).

People sometimes incorrectly add !important css suffix to bypass this requirement but that causes all kinds of other headaches.

Need Your Help

After mac os sierra update facing scrolling issue with Java applications like Intellij

swing intellij-idea java-8 jscrollpane macos-sierra

After the recent update, Mac os Sierra, to my Macbook pro, I'm facing scrolling issues with all Java applications like Intellij IDEA community edition.

WPF Dynamic Layout with ItemsControl and Grid

wpf dynamic wpf-controls grid itemscontrol

I am creating a WPF form. One of the requirements is that it have a sector-based layout so that a control can be explicitly placed in one of the sectors/cells.