медиа-запрос, перекрывающий прецедент css - PullRequest
0 голосов
/ 27 февраля 2020

Я использовал разработку для мобильных устройств для стилизации веб-страницы. Проблема в том, что медиа-запрос для большого экрана переопределяет медиа-запрос для мобильного экрана. вот как должен выглядеть мой мобильный экран

mobile screen without problems

Вот как это выглядит с медиазапросом, который не должен влиять на него

screen with a problem

вот мой css файл

 *{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    -webkit-animation: bgcolor 170s infinite;
    animation: bgcolor 170s infinite;
    -webkit-animation-direction: alternate;
    animation-direction: alternate;
    font-family: 'Varela Round', sans-serif;

}


#message{
    padding-left: 30px; position: fixed; bottom: 80px; width: 100%; height: 100px; padding-bottom: 20px;
    z-index: 9;

}

#message input{
    width: 80%;
    border: 1px solid darkgrey;
    height: 100%;
    padding: 30px;
    border-radius: 10px;
    -webkit-box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
    -moz-box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
    box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
    outline: none;
}

#message input:hover{
    cursor: pointer;
    font-size: 30px;
}

#message button{
    width: 10%;
    z-index: 9;

    height: 100px;
    border: none;
    background: white;
    border-radius: 10px;
    margin-left: 10px;
    outline: none;
    -webkit-box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
    -moz-box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
    box-shadow: -9px -9px 21px 0px rgba(54,54,54,0.66);
}


#message button:hover{
    cursor: pointer;
}

#chat-area{
    height: 90%;
    width: 100%;
    position: fixed;
    z-index: 7;
    overflow-y:auto;
    margin-bottom: 0;
    margin-top: 40%;
    border-radius: 100px;
    -webkit-box-shadow: 0px -7px 62px 1px rgba(0,0,0,0.75);
    -moz-box-shadow: 0px -7px 62px 1px rgba(0,0,0,0.75);
    box-shadow: 0px -7px 62px 1px rgba(0,0,0,0.75);
}

.messageL{
    float: left;
    margin-left: 30px;
    border-radius: 10px;
    max-width: 45%;
    min-width: 400px;
   // min-height: 100px;
    background-color: white;
    padding: 20px;
    margin-bottom: 10px;
    margin-top: 20px;
    clear: both;

}

.user{
    margin-bottom: 5px;
    font-size: 22px;
}
.content{
    font-size: 18px;
}
.messageR{
    float: right;
    margin-right: 30px;
    border-radius: 10px;
    max-width: 45%;
    min-width: 400px;
    //min-height: 100px;
    background-color: white;
    padding: 20px;
    margin-bottom: 10px;
    margin-top: 20px;
    clear: both;


}
.messageG:last-of-type{
    margin-bottom: 400px;
}

.messageC{
    text-align: center;
    border-radius: 10px;
    max-width: 70%;
    min-width: 400px;
    min-height: 70px;
    font-weight: bold;
    font-size: 20px;
    margin-left: 20%;
    margin-right: 20%;
    padding: 20px;
    margin-bottom: 45px;
    margin-top: 20px;
    background:rgba(110,109,109,0.5);
    clear: both;
}
.messageC:first-of-type{
    margin-top: 160px;
}
#header{
    position: fixed;
    padding: 10px;
    margin-bottom: 70px;

    min-height: 100px;
    width: 100%;

    font-family: 'Varela Round', sans-serif;


}
#roomname{
    font-size: 70px;
    width: 90%;
    text-align: center;
    border: 3px solid red;
    margin: 15px;
    padding: 15px;
    border-radius: 40px;
    position: relative;
}
#typing{
    max-width: 90%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    margin: 40px;
    font-size: 30px;
    position: absolute;
    left: 75px;
    top:170px;
   border: 3px solid red;
    background-color: white;
    border-radius: 30px;
    padding: 30px;
}

#online{
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    margin: 40px;
    font-size: 30px;
    position: absolute;
    left: 35px;
    top:80px;
    background-color: red;
    color: white;
    border-radius: 30px;
    padding: 30px;
}

@media only screen and (min-width:450px) {
    #header {
        min-height: 50px;
    }
    #roomname {
        font-size: 17px;
        text-align: left;
        width: 50%;
    }
    #online{
        font-size: 17px;
        left: 480px;
        top:15px;
        padding: 10px;

    }
    #typing{
        font-size: 12px;
        left: 100px;
        min-width: 200px;
        top:30px;
        padding: 10px;
        background-color: white;
    }
    #chat-area {
        margin-top: 15%;
    }

    #message {
        height: 20px;
        padding: 5px;
        font-size: 10px;
        bottom: 60px;

    }
    #message input {
        height: 50%;
        padding: 20px;


    }
    #message input:hover{

        font-size: 15px;
    }
    #message button {
        height: 40px;
    }
    .messageC {
        min-height: 30px;
        padding: 10px;
        margin-bottom: 25px;
        margin-top: 10px;
        font-size: 15px;
        max-width: 50%;
        text-align: center;

    }
    .messageC:first-of-type{
        margin-top: 80px;
    }
    .messageR {
        max-width: 23%;
        min-width: 200px;
        font-size: 13px;
        padding: 10px;


    }
    .user{
        font-size: 18px;
    }

    }

Я бы хотел, чтобы запрос затрагивал только экраны с правильным размером

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...