2016-11-18 33 views
-1

不知何故,我無法在我的科爾多瓦項目中渲染背景漸變。科爾多瓦沒有CSS背景漸變

background: #f5a953; 
background: -moz-linear-gradient(top, #f5a953 0%, #fde1b2 49%, #f5a953 100%); 
background: -webkit-linear-gradient(top, #f5a953 0%,#fde1b2 49%,#f5a953 100%); 
background: linear-gradient(to bottom, #f5a953 0%,#fde1b2 49%,#f5a953 100%); 

在我的移動設備上獲得一個空的純白色背景。

  • background更改爲background-image沒有效果。
  • background更改爲background-color至少可以使背景變爲彩色。但仍然沒有漸變。 (這很可能是第一行的效果。)

如何讓Cordova項目的背景顯示漸變?

編輯:

我現在已經創建了一個簡單的測試項目與cordova create test,然後改變了CSS背景爲以下內容:

background-color: #fde1b2; 
background-image: -moz-radial-gradient(center, ellipse cover, #fde1b2 0%, #f5a953 100%); 
background-image: -webkit-radial-gradient(center, ellipse cover, #fde1b2 0%,#f5a953 100%); 
background-image: radial-gradient(ellipse at center, #fde1b2 0%,#f5a953 100%); 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fde1b2', endColorstr='#f5a953',GradientType=1); 

chrome_desktop_view(正確) chrome_desktop_view (correct)

chrome_mobile_view (正確) chrome_mobile_view (correct)

galaxy_s6的Android 6.0.1(錯了!) galaxy_s6 (wrong!)

+0

的可能的複製(http://stackoverflow.com/questions/ 10536876/css3-linear-gradient-not-working-on-android) –

+0

http://stackoverflow.com/questions/9264640/css-android-web-app-color-gradient-issue ---- http:// stackoverflow.com/questions/10536876/css3-linear-gradient-no t-working-on-android請閱讀這些答案。 –

+0

在問這個問題之前我找到了他們,他們的解決方案對我的問題沒有影響。不要以爲我以前沒有在網上搜索過。 – Julisch

回答

0

我通過指定背景漸變的div容器,而不是全身解決了這個問題。

似乎Chrome並未顯示分配給<body>標記的背景漸變。

所以我創建了一個簡單的容器div,其中鉻奇異地顯示了背景漸變。

HTML:

<body> 
    <div id="container"> 
     ... 
    </div> 
</body> 

CSS:[不工作的機器人CSS3線性梯度]

body { 
    (nothing about the background) 
} 

div#container { 
    background-color: #fde1b2; 
    background-image: -moz-radial-gradient(center, ellipse cover, #fde1b2 0%, #f5a953 100%); 
    background-image: -webkit-radial-gradient(center, ellipse cover, #fde1b2 0%,#f5a953 100%); 
    background-image: radial-gradient(ellipse at center, #fde1b2 0%,#f5a953 100%); 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fde1b2', endColorstr='#f5a953',GradientType=1); 
}