【发布时间】:2012-03-30 01:26:20
【问题描述】:
我正在尝试在平板设备和台式机上隐藏 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>
【问题讨论】:
标签: css mobile desktop visibility zurb-foundation