2012-04-22 169 views
0

我想知道表單按鈕上的圖形。樣式HTML「提交」按鈕與圖像?

我使用表單按鈕而不是鏈接,因爲它們看起來更好。

取而代之的是:

print ('<A HREF="vote.php?vote=up" REL="nofollow">Vote +</A>&nbsp;'); 
print ('<A HREF="vote.php?vote=dn" REL="nofollow">Vote -</A> '); 

我有這樣的:

print ('<TD VALIGN="center"> '); 
print ('<FORM METHOD="post" ACTION="vote.php?vote=up" REL="nofollow"> '); 
print ('<P ALIGN="CENTER"> '); 
print ('<INPUT TYPE="submit" VALUE="Vote +" /> '); 
print ('</P> '); 
print ('</FORM> '); 
print ('</TD> '); 
print ('<TD VALIGN="center"> '); 
print ('<FORM METHOD="post" ACTION="vote.php?vote=dn" REL="nofollow"> '); 
print ('<P ALIGN="CENTER"> '); 
print ('<INPUT TYPE="submit" VALUE="Vote -" /> '); 
print ('</P> '); 
print ('</FORM> '); 

現在,在這種情況下,我想上的按鈕用拇指向上和向下的符號,而不是說「投票+「等

有沒有辦法做到這一點?

+0

或者......一個可以看出來* *站點代碼... – 2012-04-22 22:24:02

回答

1

CSS

<style> 
.btn1 input.submit-button { 
    width: 120px; 
    background-image:url(/images/vote1.png); 
    background-repeat: no-repeat; 
    background-position: 3px center; 
    padding: 5px; 
.btn2 input.submit-button { 
    width: 120px; 
    background-image:url(/images/vote2.png); 
    background-repeat: no-repeat; 
    background-position: 3px center; 
    padding: 5px; 
</style> 

代碼

print ('<INPUT TYPE="submit" VALUE="Vote +" class="btn1" /> '); 

print ('<INPUT TYPE="submit" VALUE="Vote -" class="btn2" /> '); 
+0

謝謝!我希望我能「接受」你的答案:-) – Fredashay 2012-04-23 23:55:37