2017-07-25 68 views
0

我被卡住解决这个问题。隐藏广告旗帜在移动视图

其工作,它可以在移动视图中隐藏横幅。但有一些错误。横幅显示在我的内容网站后面。它看起来像横幅将是我的网站的背景。

请任何人帮助我。

#largeAds { 
 
    width:728px; 
 
    height: 90px; 
 
    line-height: 90px; 
 
    margin: 0 auto; 
 
    background: #ccc; 
 
    text-align: center; 
 
} 
 

 
    #smallAds{ 
 
    display: none; 
 
    margin: 0 auto; 
 
    width: 468px; 
 
    height: 60px; 
 
    line-height: 60px; 
 
    background: #333; 
 
    color: #fff; 
 
    text-align: center; 
 
} 
 

 
    @media screen and (max-width: 750px) { 
 
    #largeAds { display: none } 
 
    #smallAds{display: block;} 
 
}
<div id="largeAds">Large ads (728 x 90)</div> 
 
<div id="smallAds">Small ads (468 x 60)</div>

+1

欢迎来到SO。 **我们在这里为您的代码提供帮助**,请编辑您的问题以添加完整代码,以便有人可以查看它。没有你提到的“我的内容网站”的代码。 – Syfer

回答

2

我希望这会帮助你!

@media only screen and (max-width: 720px) { 
    #largeAds { display: none ! important } 
    #smallAds{display: block; ! important} 
} 
0

我不知道如果这是你在找什么,但它会工作

<link rel='stylesheet' media='screen and (min-width: 750px) and (max-width: 99999px)' href='css/large.css' /> 
<link rel='stylesheet' media='screen and (min-width: 468px) and (max-width: 750px)' href='css/medium.css' /> 

现在,如果你把你的个人的CSS在那些将加载完美的我用这个我所有的网站:)我希望这可以帮助你出