编辑离子选项卡图标样式

编程入门 行业动态 更新时间:2024-10-26 07:27:16
本文介绍了编辑离子选项卡图标样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在一个Ionic项目中,其中的主要导航方法是制表符.中心选项卡需要突出,所以我在自己的scss中创建了这样的样式:

I am working on an Ionic project where the main navigation method is tabs. The center tab needs to stand out so I created a style in my scss like this:

i.icon.ion-ios-camera { height: inherit; border-radius: 100em; background-color: #ff5b38; }

我这样做的方式与ionic serve检查时的烧烤方式一样,我发现我的标签:

I did this the way I did barbecue when ionic serve'ing and inspecting, I find that my tab:

<ion-tab title="Post" icon="ion-ios-camera" href="#/home/post"> <ion-nav-view name="tab6"></ion-nav-view> </ion-tab>

被编译为:

所以我想只为已编译的图标创建样式(我只想为标签图标而不是整个标签设置样式).奇怪的是,这没有用.但是,检查该元素并添加如下所示的样式即可:

So I thought just to create a style for the compiled icon (I only want to style the tab icon not the whole tab). Oddly, this did not work. However, inspecting that element and adding the styles like this works:

最终结果应该看起来像这样:

The end result is supposed to end up looking like this:

但是我只能在检查器中直接编辑<i>标记来实现这些样式.我上面发布的样式(位于ionic.app.scss文件中)不会修改图标样式.难道我做错了什么?我的样式不能正确编译吗?

But I can only achieve those styles directly editing the <i> tag in the inspector. The style I posted above (which is in the ionic.app.scss file) does not modify the icon styles. Am I doing something wrong? Do my styles not get compiled correctly?

推荐答案

在以下代码段中改用:

.tabs i.icon.ion-ios-camera { height: inherit; background-color: #ff5b38; border-radius: 100em; } .tabs i.icon.ion-ios-camera:before { color: white; }

如果使用sass,请确保已执行gulp sass或ionic setup sass.希望这会有所帮助,问候.

By the way, if you use sass, ensure gulp sass or ionic setup sass has been executed. Hope this will help, regards.

更多推荐

编辑离子选项卡图标样式

本文发布于:2023-10-31 01:37:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544606.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   离子   图标   样式   编辑

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!