javascript 更改离子视图背景颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26549668/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change ion-view background color
提问by orikoko
I am using ionic, I have created my main title using ion-view
我正在使用 ionic,我已经使用 ion-view 创建了我的主标题
<ion-view title="test" class="frame_look_feel"> <ion-nav-buttons
side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons> <ion-content class="has-header">
<h1>Search</h1>
</ion-content> </ion-view>
I am trying to change the color of the title by using css and it keeps to be gray. What is the right way to do is?
我正在尝试使用 css 更改标题的颜色,但它一直是灰色的。正确的做法是什么?
回答by dbaq
You just have to add to your CSS the following line:
您只需要将以下行添加到 CSS 中:
.pane {
background-color: #000;
}
Let me know if it works for you.
请让我知道这对你有没有用。
回答by Gerg? Kajtár
Use the pane
css class with !important
to override the ion default background color,
使用pane
css 类!important
覆盖 ion 默认背景颜色,
.pane {
background-color: #464646!important;
}
and for changing the font color use:
并更改字体颜色使用:
.bar.bar-stable .title{
color:#FFF!important;
}
回答by PabloCocko
Your solution is:
您的解决方案是:
.frame_look_feel {
background-color: #FD3583;
}
Adding your style.css after ionic.css
在 ionic.css 之后添加你的 style.css
回答by Chetan Khilosiya
The problem is of css specificity. Your css rule
问题在于 css 特异性。你的 css 规则
.frame_look_feel {
background-color: #FFFFFFF;
}
This rule has specificity 10. The ionic rules generally have higher specificity. That's why your style is not applied. Look Specificityfor more details. Try something like
该规则的特异性为10。离子规则一般具有较高的特异性。这就是为什么你的风格没有被应用。查看特异性以获取更多详细信息。尝试类似
.frame_look_feel.custom_color {
background-color: #FFFFFF;
}
回答by aorfevre
If you'd like to change just the text color :
如果您只想更改文本颜色:
.frame_look_feel {
color: red;
}
of background as said by others
别人说的背景
.frame_look_feel {
background-color: red;
}