当存在背景颜色时,CSS转换不会显示

时间:2016-03-12 22:17:14

标签: html css

我制作了一个模态,当我将背景颜色应用到包含所有内容的#main div时,它不会执行过渡效果,在移除背景后,模态会执行过渡效果并慢慢消失。

要点击模态,只需点击顶部导航栏上的注册。

模态的现场演示以及#main上的背景颜色: http://79.179.201.217/

在#main上没有背景颜色的模态长的现场演示: http://79.179.201.217/test.php

请注意,#main下的以下内容会导致问题。 background-color:#eee;

CSS:

#main {
    width: 85%;
    max-width: 875px;
    margin: 70px auto;
    border-radius: 5px;
    padding: 15px;
    z-index: -600;
    background-color: #eee;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: -500;
    transition: opacity 0.18s linear, transform 0.18s linear;
    transform: scale(1.4);
    opacity: 0;
}

.modal-close {
    display: block;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    text-transform: uppercase;
    position: absolute;
    top: 6px;
    right: 20px;
}

.modal-content {
    display: block;
    margin-top: 10px;
}

.modal-container {
    display: table;
    margin: 220px auto;
    position: relative;
    border: 1px solid #eee;
    background-color: #eee;
    padding: 25px;
    border-radius: 3px;
    box-shadow: 0 1px 10px 0 rgba(0, 0, 0, .5);
}

.modal-container.x2 {
    width: 80%;
    max-width: 200px;
}

.modal-container.x3 {
    width: 80%;
    max-width: 300px;
}

.modal-container.x4 {
    width: 80%;
    max-width: 400px;
}

.modal-container.x5 {
    width: 80%;
    max-width: 500px;
}

.modal-container.x6 {
    width: 80%;
    max-width: 600px;
}

.modal-container.x7 {
    width: 80%;
    max-width: 700px;
}

.modal-container.x8 {
    width: 80%;
    max-width: 800px;
}

.modal-header {
    margin-bottom: 20px;
    border-bottom: 1px solid gray;
    font-size: 18px;
    color: #555555;
    font-weight: 500;
    text-transform: uppercase;
}

.modal.modal-visible {
    opacity: 1;
    z-index: 1000000;
    transform: scale(1.0);
}

0 个答案:

没有答案