为什么这个媒体选择器在更广泛的页面上变得活跃?

时间:2014-05-04 10:44:23

标签: css

我使用以下媒体选择器:

@media only screen and (max-width: 651px) 

由于某种原因,来自媒体选择器内部的以下css-snippet在810像素宽的页面上被触发。

.bar .link{
    width: 92%;
    margin: 0 auto;
}

来自媒体选择器的其他css都没有被触发。为什么?以下是完整的Css。

/* ==========================================================================
   HTML5 Boilerplate styles - h5bp.com (generated via initializr.com)
   ========================================================================== */

html,
button,
input,
select,
textarea {
    font-family: GillSansMTStd-Medium;
    color: #222;
}

body {
    font-size: 1em;
    line-height: 1.4;
}

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none;
}

::selection {
    background: #b3d4fc;
    text-shadow: none;
}

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

img {
    vertical-align: middle;
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

textarea {
    resize: vertical;
}

.chromeframe {
    margin: 0.2em 0;
    background: #ccc;
    color: #000;
    padding: 0.2em 0;
}

input:invalid, textarea:invalid {
    -moz-box-shadow: none;
    box-shadow: none;
}
/* ==========================================================================
   Author's custom styles
   ========================================================================== */
html, body{
    height: 100%;
}


body{
    max-width: 810px;
    background: #e9e2d9;
    font-family: GillSansMTStd-Medium;
    font-weight: normal;
    font-style: normal;
    text-align: center;
}
h1,h2{
    color: #002244;
    font-family: PerpetuaMT-Bold;
    font-weight: normal;
    font-style: normal;
    font-size: 36px;
    padding: 32px 0 0;
    margin: 0;
    line-height: 1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.apply h2,.pitch h2{
    padding-top: 50px;
}
h3{
    text-transform: uppercase;
    color: #002244;
    font-family: PerpetuaMT-Bold;
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    margin-top: 0;
    line-height: 1em;
    letter-spacing: 1px;
}

p, a{
    color: #002244;
    font-size: 12px;
    letter-spacing: 0;
    line-height: 15px;
    text-transform: uppercase;
}
a{
    cursor: pointer;
    text-decoration: underline;
}

span{
    text-transform: uppercase;
}
label span{
    text-decoration: underline;
    cursor: pointer;
}
button[disabled], html input[disabled] {
    opacity: 0.5;
}
.section.pitch{
    background: #e9e2d9;
    padding-top: 25px;
    z-index: 1;
    position: relative;
}
.section.details h3{
    font-size: 20px;
    position: absolute;
    width: 170px;
    top: 72px;
}

p.details{
    margin-bottom: -12px;
}
p.important{
    font-size: 16px;
    margin-top: -4px;
    margin-bottom: -6px;
}
p.minor{
    text-align: justify;
    text-transform: none;
    line-height: 16px;
    margin-bottom: 0;
}
.vote{
    margin: 0 70px 63px 70px;
    max-width: 670px;
}
.vote .byline{
    max-width: 500px;
    margin: 3px auto 0;
}
.special{
    font-size: 20px;
    color: #e9e2d9;
    background-color: #002244;
    text-align: center;
    text-transform: uppercase;
    padding: 12px 0 6px 0;
    font-family: PerpetuaMT-Bold;
    margin: 35px 0 0 0;
    height: 30px;
}

.special p{
    font-size: 25px;
    color: #e9e2d9;
    text-align: center;
    text-transform: uppercase;
    font-family: PerpetuaMT-Bold;
    display: inline;
}

.bar{
    width: 33%;
    display: inline-block;
    float: left;
    margin: 10px 0 32px 0;
}
.bar:hover {
    background: white;
}
.bar .link{
    padding-bottom: 6px;
}
.bar:hover .link{
    background: white;
}
.bar .link p{
    padding: 0 0 7px 0;
    margin: 10px 0 0 0;
}
.bar .link a{
    text-decoration: none;
    display: block;
    font-size: 18px;
}
.bar .link img{
    margin: 0 auto;
    width: 206px;;
}
.bar .link .after{
    margin: 0 auto;
    width: 206px;
    background-color: #002244;
    text-align: right;
    text-transform: uppercase;
    padding: 0;
}
.bar .link .after a{
    color: #e9e2d9;
    font-size: 9px;
    padding: 4px 6px 4px 0
}
.bar .like{
    width: 93%;
    background-color: #002244;
    margin: 0 auto 8px auto;
    height: 75px;
}
.bar .like p{
    color: #e9e2d9;
    margin: 0;
    font-size: 9px;
    padding: 6px 0 18px 0;
    margin: 0 30px;
    line-height: 1.2em;
}
.bar .like .fb_iframe_widget{
    padding: 8px 0 13px 0;
}
.bar .like p.percentage{
    padding: 13px 0 0 0;
    font-size: 18px;
}
.compact{
    margin-bottom: 24px;
}
.compact a{
    line-height: 1em;
}
.small{
    font-size: 9px;
    clear: both;
    padding-top: 10px;
    line-height: 1.3em;
    text-align: justify;
}
.instruction .count{
    position: absolute;
    top: 0!important;
    margin-left: -26px;
    left: 50%;
}
.count{
    color: transparent;
    margin: 11px auto 5px auto;
    height: 50px;
    width: 52px;
}
.count1{
    background: url("../img/1.png") no-repeat center;
}
.count2{
    background: url("../img/2.png") no-repeat center;
}
.count3{
    background: url("../img/3.png") no-repeat center;
}
.count4{
    background: url("../img/4.png") no-repeat center;
}
.disclaimer{
    padding-bottom: 32px;
    border-top: 1px solid #002244;
}
.disclaimer h2{
    padding: 40px 0 16px;
    font-size: 20px;
}
.disclaimer p{
    font-size: 10px;
}
a.label{
    font-size: 12px;
    color: white;
    text-decoration: none;
    line-height: 10px;
    padding: 8px 12px 7px;
    border-radius: 2px;
    background-color: #002244;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: table;
    margin: 0 auto;
}
/*justify last line hack*/
p.details:after
{content: "";
display: inline-block;
width: 100%;}

.fieldset{
    margin-bottom: 10px;
    opacity: 0.3;
    margin-top: 24px;
}


.fieldset:first-child{
    opacity: 1;
}
.video-container{
    height: 0;
    position: relative;
    padding-bottom: 56.25%;
}

.video-container .videopreview{
    position: absolute;
    top: 0;
    background: url("../img/movieposter.png") no-repeat center #002244;
    width: 100%;
    height: 100%;
    cursor: pointer;
    background-size: contain;;
}
.video-container iframe{
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.section{
    padding: 0 46px 32px;
    opacity: 0;
    float: left;
}
.section.blue{
    background-image: url('../img/whitearrow.png'), url('../img/bluearrow.png');
    background-position:  top center, bottom center;
    background-repeat: no-repeat;
    background-color: #002244;
    color: #e9e2d9;
    padding: 22px 45px 52px;
}
.section.blue h2,.section.blue h3, .section.blue p{
    color: #e9e2d9;
}
.jury {
    padding: 24px 0 15px;
}
.jury div{
    width: 24%;
    display: inline-block;
    opacity: 0;
}
.jury div a{
    color: white;
    background-color: #e9e2d9;
    width: 120px;
    height: 80px;
    border-radius: 60px;
    padding-top: 40px;
    font-size: 14px;
    line-height: 1em;
    display: block;
    margin: 0 auto;
    text-decoration: none;
}
.jury div a span{
    color: #002244;
}
.jury div a span span{
    text-decoration: underline;
}


.show{
    opacity: 1 !important;
    -moz-transition: opacity 1s;
    transition: opacity 1s;
}
.showmany>*{
    opacity: 1 !important;
    -moz-transition: opacity 1s;
    transition: opacity 1s;
}
.showmany>.n2{
    transition-delay: .2s;
}
.showmany>.n3{
    transition-delay: .4s;
}
.showmany>.n4{
    transition-delay: .6s;
}
.mathieu .mathieu,.mathieu .mathieu:hover{
    background-image: url('../img/mathieu.jpg');
    top: 6px;
    box-shadow: 0 0;
}
.mathieu .mathieu span{
    display: none;
}
.hirmane .hirmane, .hirmane .hirmane:hover {
    background-image: url('../img/hirmane.jpg');
    top: 6px;
    box-shadow: 0 0;
}

.hirmane .hirmane span{
    display: none;
}
.daniel .daniel,.daniel .daniel:hover{
    background-image: url('../img/daniel.jpg');
    top: 6px;
    box-shadow: 0 0;
}
.daniel .daniel span{
    display: none;
}
.laura .laura,.laura .laura:hover{
    background-image: url('../img/laura.jpg');
    top: 6px;
    box-shadow: 0 0;
}
.laura .laura span{
    display: none;
}

.jury div a span span{
    display: block;
    font-size: 8px;
    line-height: 1em;
    padding-top: 8px;
    text-decoration: underline;
}
.jury div p{
   min-height: 2em;
   letter-spacing: 0;
   margin: 1em auto;
}
.memeberdetailswrapper{
    height: 0;
    overflow: hidden;
    transition: all .5s;
}
.memeberdetailswrapper.expanded{
    height: 115px;
    transition: all .5s;
}

.memberdetails{
    opacity: 0;
    transition: all .3s;
    height: 100px;
    margin-bottom: -100px;
}

.memberdetails.visible{
    opacity: 1;
    transition: all .3s;
    transition-delay: .3s;
}

.instruction {
    width: 170px;
    height: 210px;
    display: inline-table;
    margin: 9px 27px 0;
    opacity: 0;
    position: relative;
}
.instruction p{
    position: absolute;
    top: 100px;
    margin-top: 0;
}
.documentholder{
    color: white;
    margin: 20px 30px;
    display: inline-block;
}

.documentholder div{
    background-size: 41px 51px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
}
.documentholder .document{
    background: url('../img/document.png') center no-repeat #002244;
    background-size: 41px 51px;
}
.documentholder .photo{
    background: url('../img/photo.png') center no-repeat #002244;
    background-size: 60px auto;
}
.documentholder .video{
    background: url('../img/video.png') center no-repeat #002244;
    background-size: 60px auto;
}
.documentholder p {
    margin-top: 10px;
    margin-bottom: 0;
}

.documentholder p.opt {
    font-size: 9px;
    margin-top: 0;
    padding: 0;
}


.fieldset.mybutton{
    opacity: 1;
}

.mybutton{
    clear: both;
}
/* General button style (reset) */
input.mybtn, a.mybtn {
    max-width: 100%;
    white-space: inherit;
    text-decoration: none;
    font-size: 20px;
    margin: 10px auto 27px auto;
    width: auto;
    border: none;
    cursor: pointer;
    padding: 16px 27px 12px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    outline: none;
    background: white;
    color: #002244;
    line-height: 1em;
    border-radius: 20px;
}

.documentholder div,.back,.jury div a,.label,input.mybtn, a.mybtn {
    box-shadow: 0 6px;
    position: relative;
}

.documentholder div:after,.back:after,.jury div a:after,.label:after,.mybtn:after {
    content: '';
    position: absolute;
    z-index: -1;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
}
.documentholder div:hover,.back:hover,.jury div a:hover,.label:hover,.mybtn:hover{
    box-shadow: 0 4px;
    top: 2px;
}
.documentholder div:active,.back:active,.jury div a:active,.label:active,.mybtn:active {
    box-shadow: 0 0;
    top: 6px;
}
.instructions h2{
    padding: 19px 0 5px;
    font-size: 20px;
}
.footer{
    background: url('../img/footerlogo.png') top center no-repeat #002244;
    height: 220px;
    width: 100%;
    position: relative;
    float: left;
}
.footer p{
    color: #e9e2d9;;
    position: absolute;
    bottom: 18px;
    right: 5px;
    font-size: 10px;
    text-transform: uppercase;
}
#legal{
    position: fixed;
    width: 810px;
    background: white;
    padding-bottom: 100px;
    z-index: 5;
}
#legal p{
    padding: 6px 0 4px;
    font-size: 14px;
    margin: 0;
    letter-spacing: 3px;
}
.mybtn.computerbtn{
    display: none;
}
.backwrapper{
    position: absolute;
    left: 17px;
}
.backwrapperlast{
    position: absolute;
    left: 17px;
    top: 43px;
}


.back{
    height: 48px;
    display: block;
    width: 48px;
    color: #002244;
    background: url('../img/back.png') 8px 12px no-repeat white;
    border-radius: 24px;
}
.fbshare{
    float: right;
    margin-top: 10px;
}
.share{
    display: block;
}
.jury div.memeberdetailmobile{
    display: none
}
.clockwrapper p.clock {
    font-size: 90px;
    letter-spacing: 10px;
    display: block;
    width: 100%;
    height: 86px;
    margin: 20px 0 0px;
    line-height: 90px;
}
.clockwrapper p.clock span {
    position: relative;
    top: -10px;
}
.clockwrapper p{
    display: inline-block;
    width: 138px;
    margin: 0 0 40px;
    font-size: 10px;
}
.knowmore{
    margin-bottom: -15px;
}
.countdown .byline {
    padding-top: 4px;
    line-height: 20px;
    letter-spacing: 1px;
}
.submission{
    padding: 38px 77px;
}
.submission.likething{
    padding: 1px;
}
.likething .fb_iframe_widget{
    position: relative;
    top: -7px;
    display: inline!important;
    margin-left: 7px;
    padding: 0;
}

.submission .special p{
    line-height: 0px;
    display: inline;
    font-size: 21px;
}
.submission .special p.likedetails{
    position: relative;
    top: -11px;
    line-height: 0;
    padding: 0;
}
.submission img{
    width: 100%;
    margin-top: 2px;
}
.submission .content{
    text-align: left;
}
.submission .content .left{
    float: left;
    max-width: 381px;
    margin-right: 40px;
    display: inline-block; 
}
.submission .content .entrepreneur .special{
    font-size: 20px;
    margin-bottom: 6px;
}
.submission .content .entrepreneur p{
    font-size: 11px;
    text-transform: none;
}
.submission .content .entrepreneur p.name{
    text-transform: uppercase;
    padding-top: 10px;
    line-height: 0px;
}
.submission .content .entrepreneur{
    padding: 6px;
    display: inline-block;
    width: 206px;
    background: white;
    float: right;
    margin-top: 10px;
}
.submission .special{
    margin: 0 0 6px 0;
}
.submission .content .entrepreneur img{
    width: auto;
    margin-top: 0;
}
.submission .project h2{
    padding-top: 20px;
} 
.submission .project p{
    text-transform: none;
    font-size: 14px;
    margin-top: 4px;
}
.content .quote {
    margin: 50px 0;
}
.content .quote p {
    font-family: PerpetuaMT-Bold;
    font-size: 19px;
    line-height: 1em;
    text-transform: none;
    margin-bottom: 0;
}
.content .quote p.mentor {
    font-size: 11px;
    font-family: GillSansMTStd-Medium;
    text-transform: uppercase;
    padding-top: 13px;
    margin-top: 0;
    text-align: right;
}
.submission .social{
    clear: both;
    height: 82px;
}
.submission .social .socialheader{
    font-family: PerpetuaMT-Bold;
    font-size: 16px;
    margin: 20px 0 1px;
}
.submission .social p{
    color: #e9e2d8;
    margin: 0 60px;
}
.submission .social>div{
    max-width: 315px;
    background-color: #002244;
    float: left;
    display: inline-block;
    height: 82px;
    padding-bottom: 5px;
}
.submission .social .sharebox{
    float: right;
    margin-right: 0
}
.submission .social>.sharebox.wider {
    width: 100%;
}
.submission .social img{
    width: auto;
}
p.likedetails, span.likedetails{
    font-size: 11px !important;
    display: block !important;
    position: relative;
    top: 2px;
}
.social p.likedetails, .social span.likedetails{
    margin: 0;
    margin-top: -5px;
    margin-bottom: 4px;
    font-size: 10px!important;
}
.submission .social .sharebox .socialheader {
    margin: 27px 0 1px 0;
}
.social .fb_iframe_widget{
    padding-top: 0;
}
.faded{
    opacity: .6;
}
/* ==========================================================================
   Media Queries
   ========================================================================== */

@media only screen and (max-width: 651px) {
    .jury div.memeberdetailmobile{
        display: block;
        max-height: 0;
        transition: all .5s;
        overflow: hidden;
    }
    .jury div.memeberdetailmobile.visible{
        max-height: 300px
    }
    .section{
        opacity: 1;
    }
    .jury div{
        opacity: 1;
        display: block;
        width: 100%;
    }
    .memeberdetailswrapper{
        display: none;
    }
    .instruction{
        opacity: 1;
    }
    .mybtn.computerbtn{
        /*display: inline-block;*/
    }
    .mybtn.applybtn{
        /*display: none;*/
    }
    .jury div a{
        margin: 0 auto;
    }
    .jury div p{
        margin: 1em auto 2em auto;
    }
    .documentholder{
        padding: 20px 0;
        width: 33%;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        margin: 0;
    }
    .documentholder div{
        margin: 0 auto;
        width: 60px;
        height: 60px;
    }
    .documentholder .video {
        background-size: 43px auto;
    }
    .documentholder .photo {
        background-size: 37px auto;
    }
    .documentholder .document {
        background-size: 27px auto;
    }
    .qq-upload-list{
        width: 75%;
        margin: 0 auto;
    }
    .qq-upload-file{
        font-size: 10px;
    }
    #legal{
        bottom: -104px;
        width: 100%;
        font-size: 12px;
    }
    #legal p{
        letter-spacing: 0;
    }
    .apply input, .apply textarea{
        font-size: 11px;
        box-sizing: border-box;
    }
    .apply input[type="submit"]{
        font-size: 16px;
    }
    .footer{
        background-size: contain;
        position: relative;
        bottom: 6px;
    }
    .backwrapper, .backwrapperlast{
        top: 17px;
    }
    .pitch h2{
        padding-top: 24px;
    }
    h2{
        font-size: 23px;

    }
    .thankswrapper h2{
        padding-top: 70px;
    }
    .thankswrapper .share {
       margin-bottom: 0;
    }
    .mobilehide{
        display: none;
    }
    p.offset{
        margin-top: 2em;
    }
    .instruction{
        height: auto;
    }
    .instruction h3{
        margin-top: 1em;
    }
    .instruction,.instruction p,.section.details h3, .instruction .count{
        position: static;
    }
    .instruction .count{
        margin: 0 auto;
    }
    .memberdetails {
        height: auto;
        margin-bottom: 0;
    }
    .fieldset{
        overflow: hidden;
    }
    .footer p{
        font-size: 9px;
    }
    .clockwrapper p.clock {
        font-size: 39px;
        letter-spacing: 4px;
        margin: 0px 0 0px;
        height: 33px;
        line-height: 1em;    
    }
    .clockwrapper p {
        width: 55px;
        margin: -5px 0 24px;
        font-size: 9px;
        text-align: center;
        padding-top: 5px;
        position: relative;
    }
    .days{
        left: -10px;
    }
    .hours{
        left: -5px;
    }
    .min{
        right: -2px;
    }
    .sec{
        right: -6px;
    }
    .clockwrapper p.clock span {
       top: -4px;
    }
    .vote{
        margin: 0 4% 63px 4%;
    }
    .bar{
        width: 100%;
    }
    }
    .bar:hover, .link .bar:hover {
        background: transparent;
    }
    .bar .link{
        width: 92%;
        margin: 0 auto;
    }
    .bar .like{
        width: 206px;
    }
    .vote .special{
        font-size: 11px;
    }
    .submission {
        padding: 57px 17px;
    }
    .submission h1{
        font-size: 26px;
    }
    .submission .special{
        height: auto;
        padding: 12px 9px 0 9px;
    }
    .submission .special p.likedetails{
        line-height: 1em;
        font-size: 10px !important;
    }
    .submission .content .left{
        margin-right: 0;
        text-align: justify;
    }
    .submission .social>div{
        height: auto;
        margin-top: 20px;
        padding: 0 20px;
        max-width: 100%;

    }
    .submission .social .sharebox{
        display: none;
    }
    .submission .content .entrepreneur{
        box-sizing: border-box;
        width: 100%;
    }
    .submission .content .entrepreneur img{
        width: 100%;
    }
}
@media print,
       (-o-min-device-pixel-ratio: 5/4),
       (-webkit-min-device-pixel-ratio: 1.25),
       (min-resolution: 120dpi) {

}

/* ==========================================================================
   Helper classes
   ========================================================================== */

.ir {
    background-color: transparent;
    border: 0;
    overflow: hidden;
    *text-indent: -9999px;
}

.ir:before {
    content: "";
    display: block;
    width: 0;
    height: 150%;
}

.hidden {
    display: none !important;
    visibility: hidden;
}

.visuallyhidden {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto;
}

.invisible {
    visibility: hidden;
}

.clearfix:before,
.clearfix:after {
    content: " ";
    display: table;
}

.clearfix:after {
    clear: both;
}

.clearfix {
    *zoom: 1;
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
    * {
        background: transparent !important;
        color: #000 !important; /* Black prints faster: h5bp.com/s */
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    abbr[title]:after {
        content: " (" attr(title) ")";
    }

    /*
     * Don't show links for images, or javascript/internal links
     */

    .ir a:after,
    a[href^="javascript:"]:after,
    a[href^="#"]:after {
        content: "";
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group; /* h5bp.com/t */
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important;
    }

    @page {
        margin: 0.5cm;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}

.fb_iframe_widget{
    padding: 5px 0 10px 0;
    height: 12px;
    overflow: hidden;
}

/*preloader*/
body:after{
    display:none;
    content:url('../img/mathieu.jpg') url('../img/hirmane.jpg') url('../img/daniel.jpg');
}
.ieshow{
    display: none;
}
.ng-modal-overlay {
  /* A dark translucent div that covers the whole screen */
  position:absolute;
  z-index:9999;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background-color:#000000;
  opacity: 0.8;
}
.ng-modal-dialog {
  /* A centered div above the overlay with a box shadow. */
  z-index:10000;
  position: absolute;
  width: 100%; /* Default */

  /* Center the dialog */
  top: 30px;
  left: 0;

}
.ng-modal-dialog-content {
  background-color: white;
  box-shadow: 4px 4px 80px #000;
  padding: 20px 40px;
  text-align: left;
  width: 75%;
  margin: 0 auto;
}

.ng-modal-dialog-content p{
    text-transform: inherit;
    font-size: 14px;
    margin-bottom: 30px;
    line-height: 1.3;
}
.ng-modal-dialog-content em{
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
    font-family: PerpetuaMT-Bold;
    font-style: normal;
    font-weight: normal;
    font-size: 1.2em;
}
.ng-modal-dialog-content h2{
    text-align: center;
    padding-top: 25px;
    padding-bottom: 10px;
}
.ng-modal-dialog-content img{
    margin-top: 12px;
    width: 100%;
}
.ng-modal-close {
  cursor: pointer;
  display: inline-block;
  font-weight: bold;
  font-family: 'arial', 'sans-serif';
  float: right;

}

2 个答案:

答案 0 :(得分:0)

我在css选择器后面有两个括号,因此关闭了媒体选择器。

}
}

答案 1 :(得分:0)

我不明白你的问题究竟是什么,但请参考下面的内容(我之前发布的答案之一)

<head></head>(如果你还没有)中加入

  <meta name="viewport" content="width=device-width, user-scalable=no" /> <-- user-scalable=yes if you want user to allow zoom -->

根据您的要求更改@media样式//改变宽度

@media only screen (max-width: 500px) {
 // or as per your needs, as I try to explain below
}

现在我试着解释一下......:)

@media (max-width:500px)

对于要max-width 500px @media screen and (max-width:500px) 的窗口,您要应用这些样式。在这种情况下,在大多数情况下,你会谈论比桌面屏幕小的任何东西。

screen

对于具有max-width的设备和500px screen print的窗口应用该样式。除了指定@media only screen and (max-width:500px) 而不是other media types最常见的另一个only之外,这几乎与上述相同。

only

以下是来自W3C的quote来解释这一个。

  

关键字“@media all and (min-width: 500px) { } @media all and (max-width: 500px) and (min-width: 300px) { } @media all and (max-width: 299px) { } ”也可用于隐藏旧用户代理的样式表。用户代理必须处理以“仅”开头的媒体查询,就好像“仅”关键字不存在一样。

由于没有&#34; If &#34;这样的媒体类型,旧浏览器应该忽略样式表。


我试着在网上收集更多信息。

And


@media (min-width: 600px) and (max-width: 800px) {
  html { background: red; }
}

Or

媒体查询是什么:逻辑if语句。 &#34;如果&#34;这些事情对于浏览器都是正确的,使用内部的CSS。

@media (max-width: 600px), (min-width: 800px) {
  html { background: red; }
}

关键字和。

Not

逗号分开。

@media not all and (max-width: 600px) {
  html { background: red; }
}

从技术上讲,这些被视为分离媒体查询,但这是有效的和或。

@media (max-width: 400px) {
  html { background: red; }
}
@media (min-width: 401px) and (max-width: 800px) {
  html { background: green; }
}
@media (min-width: 801px) {
  html { background: blue; }
}

使用关键字not来反转逻辑。

@media (min-width: 400px) {
  html { background: red; }
}
@media (min-width: 600px) {
  html { background: green; }
}
@media (min-width: 800px) {
  html { background: blue; }
}

不这样做(最大宽度:600px)似乎对我不起作用,因此上面的语法略显时髦。也许有人可以向我解释。请注意,这不仅适用于当前媒体查询,因此如果您以逗号分隔,它只会影响它所在的​​媒体查询。另请注意,不是整个媒体查询的逻辑,而不是整个媒体查询的逻辑。不是x和y =不是(x和y)≠(不是x)和y

<强>异

要确保一次只有一个媒体查询生效,请使数字(或其他)成为可能。通过这种方式进行心理管理可能更容易。

html { background: red; }

@media (min-width: 600px) {
  html { background: green; }
}

从逻辑上讲,这有点像一个switch语句,只是没有一个简单的方法来做&#34;如果这些都不匹配,那么#34;像默认一样。

<强>重写

没有什么能阻止同时存在多个媒体查询。在某些情况下使用它可能更有效,而不是将它们全部排除。

html { background: red; }

@media (max-width: 600px) {
  html { background: green; }
}

媒体查询不会对它们包含的选择器添加任何特异性,但源顺序仍然很重要。以上将有效,因为它们是正确的订购。交换该顺序,在浏览器窗口宽度超过800px时,背景将是红色的,也许是好奇的。

移动优先

您的小屏幕样式位于常规屏幕CSS中,然后随着屏幕变大,您可以覆盖所需的内容。所以,一般来说,最小宽度的媒体查询。

@media 
  only screen and (min-width: 100px),
  not all and (min-width: 100px),
  not print and (min-height: 100px),
  (color),
  (min-height: 100px) and (max-height: 1000px),
  handheld and (orientation: landscape)
{
  html { background: red; }
}

桌面优先

您的大屏幕样式位于常规屏幕CSS中,然后随着屏幕变小,您可以覆盖所需的内容。所以,一般来说,max-width媒体查询。

{{1}}

你可以随心所欲地复杂化。

{{1}}

请注意,唯一的关键字旨在阻止非媒体查询支持浏览器不加载样式表或使用样式。不知道有多么有用/仍然有用。

And for media queries priorites

来源:one two three four five