2016-12-15 116 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

相關問題