html - 如何根据 ionic 应用程序构建类型在 css 中应用 if else?

标签 html css ionic4

我正在创建简单的 ionic 4 应用程序,我正在为 android 和 ios 使用一些 css。现在当我构建 ios 时,android css 发生冲突。我想根据构建类型在 css 中设置 if/else 条件吗?

最佳答案

对于特定于平台的 css,无需编写 if-else 来在 css 类之间切换。

ionic 4 中有针对平台特定 css 的方法。

对于 android 平台,请像这样编写您的 css:
md 因为 android 以及其他平台默认使用 Material 设计。

.md .sample {}

同时使用 IOS 平台:

.ios .sample {}

这里是 docs了解更多信息。

关于html - 如何根据 ionic 应用程序构建类型在 css 中应用 if else?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57037720/

相关文章:

html - 垂直对齐元素集

javascript - 悬停在按钮上的CSS技巧按钮

javascript - 通过单击按钮切换 BODY 元素的背景颜色(CSS 类)时如何更改 H2 颜色?

html - HTML 中的 BASE64 不起作用

typescript - 如何通过 Ionic 4 选项卡按钮传递参数

javascript - 将外部站点加载到 div

html - 如何调整容器大小以适应其子项的宽度

javascript - 位置为 : absolute I'm not able to scroll down my content

angular - 如何将数字分配给类型 'BehaviorSubject<number>'

css - Ionic 4 - 使用 ionic 刷新时, ionic 页脚变得透明