响应式媒体查询

时间:2018-06-09 17:54:46

标签: css twitter-bootstrap media responsive

我现在很困惑,所以我试图创建一个响应式网站。

由于某些原因,我的媒体查询没有触发?我有以下的CSS,从X-Small低于480px到高达575.98px,它可以正常工作。但是通过媒体查询,我添加到767.98px范围的任何东西都不起作用?

@media only screen and (min-width : 480px) {
    .card-4{
        display: none;
    }
}
@media (max-width: 575.98px) {
    #about{
        padding: 0 0.5rem 0 0.5rem;
    }
    .about-photo img{
        width: 70%;
    }
    .about-text{
        margin: auto;
        text-align: center;
        padding: 1rem 0 3rem 0;
    }
    .about-text h1, .about-text p{
        text-align: center;
        float: none;
    }
    .table{
        margin: 0;  
        padding-left: 0;
    }
    .table li{
        margin: auto;
        padding-top: 0.3rem;
        padding-left: 2rem;
        text-align: left;   
    }
    #skills-list{
        margin: 0 2rem 0 2rem;
    }
    #skills-list li{
        text-align: left;
        padding-bottom: 1rem;   
    }
    .card-1{
        display: none;
    }
    .card{
        margin-left: auto !important; 
        margin-right: auto !important;
        text-align: center;
    }
    .cards-container{
        margin: 0 !important;
    }
    .timeline > li > .timeline-panel {
    width: 85%;
    float: right;
    padding: 1.2rem;
}
    .timeline:before {
    left: 6%;
}
    .timeline > li > .timeline-badge {
    width: 44px;
    height: 44px;
    left: 6%;
}
.timeline > li > .timeline-panel:before {
    border-left-width: 0;
    border-right-width: 15px;
    left: -15px;
    right: auto;
}
.timeline > li > .timeline-panel:after {
    border-left-width: 0;
    border-right-width: 14px;
    left: -14px;
    right: auto;
}
.square-1-text, .square-2-text, .square-3-text{
    height: 31rem;
}
.square-1{
    order:1;
}
.square-1-text{
    order:2;
}
.square-2{
    order:3;
}
.square-2-text{
    order:4;
}
#passions-section{  
    padding-bottom: 0;
}
#skills-list li.i{
        list-style-position: outside !important;
        display: none;
    }
/*// Small devices (landscape phones, less than 768px)*/
@media (max-width: 767.98px) {
    }

/*// Medium devices (tablets, less than 992px)*/
@media (max-width: 991.98px) {

}

/*// Large devices (desktops, less than 1200px)*/
@media (max-width: 1199.98px) {

}

1 个答案:

答案 0 :(得分:2)

在实施完全自适应网站时,在CSS媒体查询中使用正确的断点可能是最重要的决定。

最小宽度:320px(较小的手机视点) 最小宽度:480px(小型设备和大多数手机) 最小宽度:768px(大多数平板电脑) 最小宽度:992px(较小的桌面视点) 最小宽度:1200px(大型设备和宽屏幕)

在你的情况下试试这个

@media (min-width:500px) and (max-width:750px)
相关问题