2014-03-18 31 views
0

它是這樣的,我必須在提交按鈕上有一張圖片,但它根本沒有出現。提交完全沒有圖片

我想它來到像這樣的事情:

enter image description here

現在看到我這個樣子,我不明白爲什麼它不會顯示在網頁上。

enter image description here

的Html

<div id="sogbar"> 
<input type="submit" name="sognu" class="sognu"> 
<div class="cl"></div> 
</div> 

CSS

#sognu { 
    background: url('/img/sogindhold/sognu.png') no-repeat; 
    float: right; 
    background: -moz-linear-gradient(#e4d24a,#dec83d); 
    background: -webkit-linear-gradient(#e4d24a,#dec83d); 
    background: -o-linear-gradient(#e4d24a,#dec83d); 
    background: -ms-linear-gradient(#e4d24a,#dec83d); 
    background: linear-gradient(#e4d24a,#dec83d); 
    box-shadow: inset 0 1px 1px rgba(255,255,255,.5); 
    -webkit-box-shadow: inset 0 1px 1px rgba(255,255,255,.5); 
    border: 1px solid #2a2c0f; 
    border-radius: 5px; 
    height: 35px; 
    width: 75px; 
    position: relative; 
    cursor: pointer; 
} 
#sognu:after { 
    display: block; 
    position: absolute; 
    content: ''; 
    width: 16px; 
    height: 16px; 
    right: 0; 
    left: 0; 
    top: 14px; 
    bottom: 0; 
    margin: 0 auto; 
} 

回答

0

我不知道你是怎麼想實現這個,但如果你希望顯示#sognu圖標元件。

看來你的目標了錯誤的元素,如果你想這些聲明適用於input元素,你應該使用一個超前時段.選擇由它的類名的元素。

I.e.改變#sognu.sognu

然後,你可以按如下方式使用多個值background屬性:

.sognu { 
    float: right; 
    background: url('/img/sogindhold/sognu.png') 50% 50% no-repeat, -moz-linear-gradient(#e4d24a,#dec83d); 
    background: url('/img/sogindhold/sognu.png') 50% 50% no-repeat, -webkit-linear-gradient(#e4d24a,#dec83d); 
    background: url('/img/sogindhold/sognu.png') 50% 50% no-repeat, -o-linear-gradient(#e4d24a,#dec83d); 
    background: url('/img/sogindhold/sognu.png') 50% 50% no-repeat, -ms-linear-gradient(#e4d24a,#dec83d); 
    background: url('/img/sogindhold/sognu.png') 50% 50% no-repeat, linear-gradient(#e4d24a,#dec83d); 

    box-shadow: inset 0 1px 1px rgba(255,255,255,.5); 
    -webkit-box-shadow: inset 0 1px 1px rgba(255,255,255,.5); 
    border: 1px solid #2a2c0f; 
    border-radius: 5px; 
    height: 35px; 
    width: 75px; 
    position: relative; 
    cursor: pointer; 
} 
+0

它對我有很大的幫助,但是現在這張照片在背景中太大而無法提交,我可以在那裏做什麼? – Jesperbook

+0

@Jesperbook首先確保你想在'#sognu'上應用背景圖片。但是,您可以使用['background-size'](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size)屬性更改圖像的大小。 –

+0

它仍在建設中。它只出現一半。我已經嘗試了它的新代碼, – Jesperbook

0

您使用的是你的CSS樣式ID #sognu,但在HTML你caliing .sognu類。

+0

Oooh檢查! - 感謝幫助。 – Jesperbook