【发布时间】:2017-08-02 05:27:52
【问题描述】:
我在前端测试站点上测试了一些 RWD 媒体查询,我刚刚将代码复制到我的 style.css 文件中,但它们似乎不想工作。我正在使用 html5blank作为父母的主题。这就是我的 header.php -
<!doctype html>
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
<link href="//www.google-analytics.com" rel="dns-prefetch">
<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory')?>/style.css" />
<link href='https://fonts.googleapis.com/css?family=Merriweather+Sans:100,200,400,700,700i,800,800i' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<?php bloginfo('description'); ?>">
<?php wp_head(); ?>
<script>
// conditionizr.com
// configure environment tests
conditionizr.config({
assets: '<?php echo get_stylesheet_directory_uri(); ?>',
tests: {}
});
</script>
</head>
我相信这一切都应该如此。在我的 style.css 我有这个 -
/*
Theme Name: HTML5 Blank Child Theme
Description: A child theme of the HTML5 Blank WordPress theme
Author: Mike Whitehead
Template: html5blank
Version: 1.0.0
*/
/* ALL STYLES BELOW */
我的媒体查询低于我的定制样式但高于我的骨架网格代码 -
/* RWD HERE */
@media screen and (max-width: 1000px) {
/* SOME CODE HERE */
}
@media screen and (max-width: 480px) {
/* SOME CODE HERE */
}
/*
* Skeleton V2.0.4
* Copyright 2014, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/29/2014
*/
/* Table of contents
––––––––––––––––––––––––––––––––––––––––––––––––––
- Grid
- Base Styles
- Typography
- Links
- Buttons
- Forms
- Lists
- Code
- Tables
- Spacing
- Utilities
- Clearing
- Media Queries
*/
我的 RWD 媒体查询是否必须位于 style.css 文件的绝对底部?还有什么我想念的吗?需要缩进吗?
【问题讨论】:
-
是的。您的媒体查询应该在 bootom 进行。
-
@vel 没用。
-
你能分享我加载css列表吗?
-
@vel 你是什么意思?
-
或者你试过
@media (max-width: 1000px) { /* SOME CODE HERE */ }?
标签: php css wordpress responsive-design