2017-04-08 91 views
0

使用Chrome开发人员工具尝试识别要在媒体查询中操作的元素后,我没有任何运气让横幅响应平板电脑和iPhone的尺寸。这是网址:媒体查询效果不理想

http://thursdaypools.mediafuel.net/innovations/fiberglass-pool-anchoring-system/

如果你调整它,你会看到横幅图像完全不改变大小,我已经试过如下:

@media screen and (max-width: 991px) {   #video-header {   height: 240px;   } } 

/*@media (max-width: 980px) { .banner {  height: 30vh; } }*/ 

代码多数民众赞成评论是由我之前的人写的,当我得到它时它不起作用,而在顶端看到的是我尝试使用我的工作后的努力。 #video-header和.banner似乎都没有什么区别。

为旗帜的代码是这一个:

<?php get_header(); ?> 
    <div id="post-page" class="single-innovations-page content-area"> <?php get_template_part('template-parts/content', 'page-intro'); ?> 
<!--dancortes added this code below here--> 
<?php get_template_part('template-parts/content','page-banner'); ?>   
    <?php if(get_field('product_video')): ?> 
    <div id="video-header" class="full-video"> 
    <iframe id="player" type="text/html" width="100%" height="100%" src="<?php the_field('product_video'); ?>?enablejsapi=1&amp;rel=0;" frameborder="0" allowfullscreen></iframe> 
<div onClick="closeVideo()" class="close-video">         
<p>Close</p> 
</div> 
</div> 
<?php endif; ?><!--product_video--> 
    <main class="subpage-content"> 
    <div class="medium-wrapper"> 
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
     <div class="innovation-information"> 
     <?php the_field('innovation_information'); ?> 
     </div> 
     <?php endwhile; else : ?> 
     <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> 
     <?php endif; ?> 
    </div> 
</div><!--page-top--> 

回答

2

添加background-size.banner

.banner { 
    background-size: contain; 
} 
+0

上帝保佑你丹谢谢。 – Daniel

+0

降低横幅高度以摆脱较小屏幕的媒体查询中横幅上方和下方的空白区域。 –

+0

乐意帮忙! –