和标题一样,我想更改选定选项卡的背景颜色。我没有发现任何允许在文档中使用的变量。 (http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/)。如何实现它?Ionic2选项卡 - 如何更改选定选项卡的颜色?
1
A
回答
1
我找到了答案:
#tab-t1-0[aria-selected=true] {
background-color: red;
color: #000;
}
是标签的数量。
1
设置和翻转一个类。
f.e.在构造函数集:
document.getElementById("tab1").className = "tab";
document.getElementById("tab2").className = "tab";
document.getElementById("tab3").className = "tab active";
,并设置一些CSS
tab.active{
background-color: black;
}
但是,如果你想覆盖离子的变量,你应该使用
$colors(
'primary': '#ffffff'
)
,并在你的HTML设置
<!-- ionic2 beta (using angular 2.0.0-RC.4)-->
<yourTab primary>
<!-- or when using ionic2 RC0 (using angular 2.0.x) -->
<yourTab color="primary">
3
覆盖t他的课在您的页面scss文件中。
.tabs-md .tab-button[aria-selected=true] {
color: #fff; /*your text color */
background: #808080; /* your background color*/
}
希望这将有助于:)
1
官方的方法是:
更改为标签的theme/variables.scss
活动图标机器人是:
$tabs-md-tab-icon-color-active: red;
在iOS
$tabs-ios-tab-icon-color-active: red;
0
这是一种适合我的工作,
对于Android,
.tabs-md[tabsLayout=icon-hide] .tab-button,
.tabs-md[tabsLayout=title-hide] .tab-button,
.tabs-md .tab-button.icon-only,
.tabs-md .tab-button.has-title-only {
font-weight: 900 !important;
}
.tabs-md .tab-button[aria-selected=true] .tab-button-text {
-webkit-transform: none !important;
color: #fff;
}
对于iOS,
.tabs-ios[tabsLayout=icon-hide] .tab-button,
.tabs-ios[tabsLayout=title-hide] .tab-button,
.tabs-ios .tab-button.icon-only,
.tabs-ios .tab-button.has-title-only {
font-weight: 900 !important;
}
.tabs-ios .tab-button[aria-selected=true] .tab-button-text {
-webkit-transform: none !important;
color: #fff;
}
相关问题
- 1. 更改选项卡选择选项卡时的文本颜色
- 2. 如何更改滑动选项卡中选定的选项卡颜色?
- 3. 如何更改actionbarsherlock选项卡颜色和选项卡下的行的颜色?
- 4. 更改选项卡布局选项卡颜色?
- 5. 如何更改活动/选定选项卡的颜色?
- 6. 如何更改tablayout中选定选项卡的颜色?
- 7. 我如何更改jtabbedpane选定的选项卡背景颜色
- 8. 更改选项卡的颜色取决于选择哪个选项卡
- 9. 更改“选项卡控件”颜色
- 10. 更改UITabBarController选项卡未选中时选项卡图标颜色
- 11. JavaFX CSS样式:更改选定选项卡的高亮颜色
- 12. jQuery更改选定选项卡的颜色
- 13. 更改TabLayout的选定选项卡背景和文本颜色
- 14. 背景选项卡的颜色不选择选项卡
- 15. 如何在选择时更改颜色选项卡
- 16. jQuery UI选项卡 - 如何更改选项卡的位置
- 17. react-native-router-flux选项卡如何更改选定选项卡的图标?
- 18. 添加选项卡与选定的假但选项卡设置颜色tabSelectedTextColor
- 19. 如何添加更改选定选项卡的颜色的onclick动作?
- 20. 反应原生选项卡视图:如何更改选项卡更改上的文本颜色
- 21. WPF选项卡控件:设置选项卡颜色?
- 22. JTabbedPane:更改选项卡标题时更改选项卡大小
- 23. 编辑项目的选项卡颜色
- 24. 如何更改禁用的选项卡控件的颜色
- 25. 如何更改iphone中Tabbar中的选定选项卡项?
- 26. 如何更改Android中以下3个选项卡的颜色?
- 27. 如何更改ActionBar导航选项卡的颜色?
- 28. 如何更改活动离子选项卡的颜色?
- 29. 如何更改Materialise CSS选项卡的下划线颜色?
- 30. 如何更改holoeverywhere选项卡的颜色?