我在互联网上来回搜索了几次,我就是不明白在CSS中使用媒体查询时我似乎做错了什么。一些背景信息:我使用了一个名为"Sela“的wordpress主题,并为它创建了一个子主题,这是我的子主题的style.css:
/*
Theme Name: Sela Child
Theme URI: https://wordpress.com/themes/sela/
Template: sela
Author: Automattic
Author URI: https://wordpress.com/themes/
Description: Sela is not your typical business theme. Vibrant, bold, and clean, with lots of space for large images, this theme will look great on all devices, from desktop to mobile.
Tags: blog,custom-background,custom-colors,custom-menu,featured-images,full-width-template,microformats,right-sidebar,rtl-language-support,sticky-post,translation-ready,two-columns
Version: 1.0.15.1473287968
Updated: 2016-09-08 00:39:28
*/
.site-footer {
box-shadow: 0 5px 8px rgba(0,0,0,0.2);
background-color: #0071bc;
border-top: 1px solid #d9d9d9;
color: #fff;
}
.main-navigation .menu > li > a::after {
content: none;
}
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
#infinite-handle span {
background-color: #0071bc;
}
.site-title {
display: block;
margin: auto;
width: 55%;
}
@media screen and ((max-width:1024px) {
body {
background: #04d056;
}
然后这是我的header.php的头:
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
我真的是一窍不通,现在我正试着把背景改成绿色,但这根本不起作用!我什么都试过了!请帮我走出困境
发布于 2016-09-09 03:03:45
您的媒体查询中有两个问题:
@media screen and ((.......)使用1个括号媒体查询代码应为:
@media screen and (max-width:1024px) {
body {background: #04d056;}
}发布于 2016-09-09 02:49:32
你有:
@media screen and ((max-width:1024px) {它应该是:
@media screen and (max-width:1024px) {
//css here
}https://stackoverflow.com/questions/39398150
复制相似问题