2013-04-05 73 views
0

我的CSS:CSS背景圖像不工作 - 沒有顯示

background-image: url(/images/framework/arrow-down-small.png) no-repeat center; /* fallback */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc)); /* Saf4+, Chrome */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -webkit-linear-gradient(top, #eee, #ccc); /* Chrome 10+, Saf5.1+ */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center, -moz-linear-gradient(top, #eee, #ccc); /* FF3.6+ */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center,  -ms-linear-gradient(top, #eee, #ccc); /* IE10 */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center,  -o-linear-gradient(top, #eee, #ccc); /* Opera 11.10+ */ 
       background-image: url(/images/framework/arrow-down-small.png) no-repeat center,   linear-gradient(top, #eee, #ccc); /* W3C */ 

我要的是一個背景圖像,並在同一時間梯度。 HTML元素是:

<input type="button" class="mybutton" /> 

  • 背景圖像完全不
  • 梯度顯示是不存在

絕對路徑是正確的,因爲如果我嘗試一個簡單的背景:url(...)沒有漸變,圖像就在那裏。

怎麼了?

感謝 伯恩哈德

回答

0

隨着no-repeat你應該跳過-image,只有background:嘗試」,如:

background-image: url('image.png') no-repeat; /* Doesn't work */ 
background-image: url('image.png'); /* Works */ 

當你說你只使用background:我認爲它的工作,因爲你AREN 't using background-image

也許你應該試試:

<input type = "image" class = "mybutton"/> 

希望有所幫助!

編輯:行情都不是強制性的

background-image: url(image.png); 
background-image: url("image.png"); 
background-image: url('image.png'); 

是一回事

+0

是啊,謝謝,去不重複定位是點。 我一直認爲在網址中不需要引號,因爲它一直有效,我看到了兩個版本呢? – 2013-04-05 11:48:24

+0

你說得對,我修改了我的答案。行情不是強制性的 – Xaltar 2013-04-05 12:04:14

+0

非常感謝你:)。 – 2013-04-05 12:35:11