Php 如何在缩放时使响应性wordpress主题与Internet Explorer/Edge兼容?

Php 如何在缩放时使响应性wordpress主题与Internet Explorer/Edge兼容?,php,css,wordpress,wordpress-theming,Php,Css,Wordpress,Wordpress Theming,在Internet Explorer/Edge上缩放和打开wordpress主题时,我遇到了一个问题,在许多设备(如下面的屏幕截图)上测试后,结果最差: 无法与IE/Edge兼容: 缩放时无法响应: Index.php <?php /** * The main template file. * * This is the most generic template file in a WordPress theme * and one of the two required f

在Internet Explorer/Edge上缩放和打开wordpress主题时,我遇到了一个问题,在许多设备(如下面的屏幕截图)上测试后,结果最差:

无法与IE/Edge兼容:

缩放时无法响应:

Index.php

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package test
 */

get_header(); ?>

    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">

        <?php if ( have_posts() ) : ?>

            <?php if ( is_home() && ! is_front_page() ) : ?>
                <header>
                    <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
                </header>
            <?php endif; ?>

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php

                    /*
                     * Include the Post-Format-specific template for the content.
                     * If you want to override this in a child theme, then include a file
                     * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                     */
                    get_template_part( 'template-parts/content', get_post_format() );
                ?>

            <?php endwhile; ?>

            <?php the_posts_navigation(); ?>

        <?php else : ?>

            <?php get_template_part( 'template-parts/content', 'none' ); ?>

        <?php endif; ?>

        </main><!-- #main -->
    </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
有关更多信息,请查看


那么我如何修复它呢?

在不使用介质查询的情况下应用一些全局样式,然后根据介质查询的分辨率需要反向工作

我对你的css做了一些小改动,在1200宽的范围内观看,它完美地解决了菜单问题。缩放时,默认为相关媒体查询

.main-navigation {
width: 960px;
margin: auto;
}
.menu-primary-menu-container {
margin: 0 0 0 200px;
float: right;
}
ul#primary-menu {
margin: 0px;
}
.main-navigation li {
float: left;
}
.main-navigation a {
padding: 4px 29px 0 16px;
display: block;
text-decoration: none;
/* line-height: 50px; */
color: #000;
font-family: sans-serif;
font-weight: bold;
font-size: small;
}

Bootstrap是一个更好的方法,但是我看到您已经在这个主题上做了大量的工作。这可能不是一个完整的解决方案,但在理论上,如果你做了一些小的调整,我在下面做,你可以根据需要调整不同的视口大小在CSS媒体查询。< /P>你应该考虑学习引导。别担心,你不必学习整个引导。只要学习网格系统。这很简单。我已经更新了我的主题,在1200px、1024px和980px中进行了一些调整,但是我只有左侧边栏的问题,当调整不同的视口大小时,不能跟随红线。如何修复?我想您可能会遇到一些问题,因为您正在尝试将元素与背景图像对齐。更好的方法可能是分解背景图像,使顶部位于标题区域,然后使用CSS为主要元素创建边框和边框半径,这样它可以随视口缩放。
.main-navigation {
width: 960px;
margin: auto;
}
.menu-primary-menu-container {
margin: 0 0 0 200px;
float: right;
}
ul#primary-menu {
margin: 0px;
}
.main-navigation li {
float: left;
}
.main-navigation a {
padding: 4px 29px 0 16px;
display: block;
text-decoration: none;
/* line-height: 50px; */
color: #000;
font-family: sans-serif;
font-weight: bold;
font-size: small;
}
.main-navigation {
width: 960px;
margin: auto;
}
.menu-primary-menu-container {
margin: 0 0 0 200px;
float: right;
}
ul#primary-menu {
margin: 0px;
}
.main-navigation li {
float: left;
}
.main-navigation a {
padding: 4px 29px 0 16px;
display: block;
text-decoration: none;
/* line-height: 50px; */
color: #000;
font-family: sans-serif;
font-weight: bold;
font-size: small;
}