我想为 firefox 浏览器显示不同的代码,为所有其他浏览器显示另一个代码。这包括 IE、Chrome、Safari、Opera 和移动浏览器在内的所有版本。
<div class="firefox">
<p>This should be only shown in firefox browser versions.</p>
</div>
<div class="nonfirefox">
<p>This should be only shown in non-firefox browsers including mobile.</p>
</div>
两者不会出现在同一个浏览器中,这一点非常重要。
我可以很容易地做到这一点来隐藏非 firefox 版本。
@-moz-document url-prefix () {
.nonfirefox {
display:none;
}
}
但是隐藏在其他浏览器中显示的 firefox 版本的最简单方法是什么。
最佳答案
// Hide in Chrome, Safari, ...
.firefox {
display:none;
}
// Show in firefox
@-moz-document url-prefix() {
.nonfirefox {
display:none;
}
.firefox {
display:block;
}
}
关于html - 针对所有非 firefox 浏览器。最简单的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33895602/