【发布时间】:2016-09-09 03:10:49
【问题描述】:
我在互联网上来回搜索了几次,但我根本无法理解在 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>
我真的一无所知,现在我正在尝试将背景更改为绿色,但这根本不起作用!我什么都试过了!请帮助我摆脱痛苦
【问题讨论】:
-
您有语法错误。当你需要说
(max-width:1024px)时,你说的是((max-width:1024px)。 JSFiddle
标签: css wordpress themes media