我正在尝试在平板设备和台式机上隐藏 div。我正在使用 zurbs 基金会http://foundation.zurb.com/docs/layout.php这样做。但是,当我尝试应用类时hide-on-tablets
,hide-on-desktops
第二个会以某种方式覆盖第一个类,并且会hide-on-tablets
显示在平板电脑上。我可以创建自己的媒体查询并将它们隐藏在两者上,但我认为我应该利用类或拥有所有代码的意义。您可以通过调整浏览器大小在我的网站http://goodmorningmoon.ca上查看它。该网站的密码是 springy88
提前致谢。
Foundation.css 可见性
/* --------------------------------------------------
:: Mobile Visibility Affordances
---------------------------------------------------*/
.show-on-phones { display: none !important; }
.show-on-tablets { display: none !important; }
.show-on-desktops { display: block !important; }
.hide-on-phones { display: block !important; }
.hide-on-tablets { display: block !important; }
.hide-on-desktops { display: none !important; }
/* Modernizr-enabled tablet targeting */
@media only screen and (max-width: 1280px) and (min-width: 768px) {
.touch .hide-on-phones { display: block !important; }
.touch .hide-on-tablets { display: none !important; }
.touch .hide-on-desktops { display: block !important; }
.touch .show-on-phones { display: none !important; }
.touch .show-on-tablets { display: block !important; }
.touch .show-on-desktops { display: none !important; }
}
@media only screen and (max-width: 767px) {
.hide-on-phones { display: none !important; }
.hide-on-tablets { display: block !important; }
.hide-on-desktops { display: block !important; }
.show-on-phones { display: block !important; }
.show-on-tablets { display: none !important; }
.show-on-desktops { display: none !important; }
}
我的 HTML
<div class="row touch">
<div id="iphoneNav" class="four columns hide-on-tablets hide-on-desktops">
<?php wp_nav_menu( array( 'theme_location' => 'iphone-menu','menu_class' => 'nav-bar', 'container' => 'nav') ); ?>
</div>
</div>