Css HTML对话框-背景色

Css HTML对话框-背景色,css,html,dialog,modal-dialog,Css,Html,Dialog,Modal Dialog,我一直在遵循一些关于如何创建对话框的指南: 出于某种原因,我的CSS没有呈现背景色 这是我的小提琴: HTML: 感谢您的任何帮助您只需使用: 背景:颜色 不要使用不起作用的背景色。您只需使用: 背景:颜色 而不是不起作用的背景色。将背景色更改为任何其他颜色,然后再更改为白色!它在Chrome中工作:看看这里。。。 将背景颜色更改为任何其他颜色,然后更改为白色!它在Chrome中工作:看看这里。。。 请这样试试 .modal::after { position: fixe

我一直在遵循一些关于如何创建对话框的指南:

出于某种原因,我的CSS没有呈现背景色

这是我的小提琴:

HTML:


感谢您的任何帮助

您只需使用:

背景:颜色


不要使用不起作用的背景色。

您只需使用:

背景:颜色


而不是不起作用的背景色。

将背景色更改为任何其他颜色,然后再更改为白色!它在Chrome中工作:看看这里。。。


将背景颜色更改为任何其他颜色,然后更改为白色!它在Chrome中工作:看看这里。。。

请这样试试

 .modal::after {
        position: fixed;
        content:'';
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
    }
请这样试试

 .modal::after {
        position: fixed;
        content:'';
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
    }

您要求CSS在.modal上应用白色背景。。。当背景为白色时。。。白色对白色的花花公子…你要求CSS在.modal上应用白色背景。。。当背景为白色时。。。白色对白色,伙计…对不起,我是指表盘周围的背景色。对不起,我是指表盘周围的背景色。
body{
     background-color: blue;
}
.modal {
    background-color: white;
    border-radius: 5px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
    height:200px;
    width:300px;
    position:fixed;
    top:50%;
    left:50%;
    margin-left: -150px;
    margin-top:-100px;
}
 .modal::after {
        position: fixed;
        content:'';
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
    }