【问题标题】:Hide Advertising Banner in Mobile View在移动视图中隐藏广告横幅
【发布时间】:2017-07-25 16:14:45
【问题描述】:

我被困在解决这个问题上。

它的工作原理,它可以在移动视图中隐藏横幅。但有些不对劲。我的内容网站后面的横幅显示。它看起来像横幅将成为我网站的背景。

请任何人帮助我。

#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>

【问题讨论】:

  • 欢迎来到 SO。 我们在这里为您的代码提供帮助,请编辑您的问题以添加完整的代码,以便有人可以查看它。您提到的my content site 没有代码。

标签: javascript jquery html css


【解决方案1】:

希望对你有帮助!

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

【讨论】:

    【解决方案2】:

    我不确定这是否是您正在寻找的,但它会起作用

    <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 放入其中,它将完美加载,我将其用于我的所有网站 :) 我希望这对您有所帮助

    【讨论】:

      猜你喜欢
      • 2015-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-23
      • 1970-01-01
      • 2014-11-23
      • 2019-08-12
      • 1970-01-01
      相关资源
      最近更新 更多