2016-12-15 141 views
1

我想在flexbox上设置背景颜色,并尝试如下。在App自定义背景颜色flexbox

类定义:

<App id="app" class="weight-protocol"> 
</App> 

上实现Flexbox:

<FlexBox 
     height="20%" 
     width="100%" 
     alignItems="Start" 
     class="calendar-header-bg" 
     justifyContent="Center"> 
在CSS文件

.weight-protocol .calendar-header-bg { 
    background-color: #007DB2; 
} 

的自定义背景色不会在所有的应用你可以看到: enter image description here

看看代码检查器,自定义CSS类停留在开始calendar-header-bg而不是最后。

回答

1

你试过没有.weight-protocol

.calendar-header-bg { 
    background-color: #007DB2; 
} 

如果没有工作,你可以使用!important标签:

.calendar-header-bg { 
    background-color: #007DB2 !important; 
} 

您也可以尝试只使用background标签,而不是background-color

.calendar-header-bg { 
    background: #007DB2 !important; 
} 

我希望这有助于...

祝你好运!

0

不应该FlexBox有一些CSS来做你想要实现的?使用检查员并观察投币箱的div。 你能更具体吗?

0

我猜这个问题是特异性也称为选择器的重要性。这意味着你正在使用的选择器(嵌套在类中的选择器)总体上没有什么重量,并且很可能会被你正在使用的库中的另一个更重的选择器覆盖。例如,图书馆可能会在某个类内的某个类中定位一个类或类似的东西。

我的建议是看样式的应用开发者工具中,看看有什么会覆盖你的风格,然后决定你是否让你的选择更强大(通过使其更具体)或您background-color声明后,只需添加!important