2016-02-12 36 views
0

我有這樣的代碼大氣壓:如何設置輸入標籤的背景圖像?

<form id="" class="cf" action=""> 
     <div class="input_wrap cf"> 
      <label for="test"></label> 
      <input id="test" type="text"> 
     </div> 
    </form> 

這裏是CSS代碼:

.test { 
     display: inline-block; 
     max-width: 100%; 
     background: url("../img/magnifying_glass_icon.svg") no-repeat right; 
} 

在哪裏可以是問題嗎? 試過很多變種 感謝

+0

變化。測試到#TEST – Edd

回答

2

試試這個

#test 
{ 
    display: inline-block; 
    max-width: 100%; 
    background: url("../img/magnifying_glass_icon.svg") no-repeat scroll center right; 
} 
+0

現在它的工作)非常感謝 –

+0

@ GrommashTheHellscream既然你沒有爲輸入類型設置** class **屬性,你可以使用** id **來申請css。如果你將class屬性設置爲** test **,那麼你的CSS就可以工作了 – praveen

0

試試這個

.test { 
     display: inline-block; 
     max-width: 100%; 
     background: url("../img/magnifying_glass_icon.svg") no-repeat scroll center right; 
} 
+0

嘗試 不工作 –

+0

什麼是你想exacly做什麼? –

+0

我已經在這裏工作,你沒有針對元素..http://codepen.io/eddyerburgh/pen/GozoBr – Edd