CSS媒体查询(@media功能)

时间:2016-11-03 15:41:29

标签: css wordpress media-queries

我有一个wordpress网站。我正面临着自定义媒体css代码的问题。当我尝试保存代码时,它会消失并且不会反映在网站上。任何帮助将不胜感激。以下是我要添加的代码:

@media only screen and (max-width: 719px)
.site-title {
display: none;
}

@media only screen and (max-width: 719px)
#nav-header.nav-container {
background-image: URL(http://i2.wp.com/vedsutra.com/wp-content/uploads/2016/07/cropped-VedSutra_logo.png);
background-repeat: no-repeat;
background-position: center;
}

1 个答案:

答案 0 :(得分:3)

您应该将查询包装在{}中,如下例所示:

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

    .site-title {
        display: none;
    }

    #nav-header.nav-container {
        background-image: URL(http://i2.wp.com/vedsutra.com/wp-content/uploads/2016/07/cropped-VedSutra_logo.png);
        background-repeat: no-repeat;
        background-position: center;
    }
}