0

I am trying to create a voting system similar to that of stackoverflow, but I can't figure out how to call on the css instead of the images.

I have the following code:

 <input type="image" id="uparrow{{ vote.id }}" src="{{ MEDIA_URL }}static/img/aup{% if vote and vote.is_upvote %}mod{% else %}grey{% endif %}.PNG">

How can I change the code so it calls a css class instead of an img src?

agassi0430
  • 1,155
  • 1
  • 13
  • 31
  • [This answer](http://stackoverflow.com/questions/195632/how-to-change-an-input-button-image-using-css) could point you in the right direction. – Jesse the Game Nov 14 '12 at 08:27

1 Answers1

0

You are looking for something like:

<input type="image" id="uparrow{{ vote.id }}" 
       src="{{ MEDIA_URL }}static/img/vote.png"
       class="otherclass {% if vote and vote.is_upvote %}upvote{% else %}novote{% endif %}" />

The image would have classes "otherclass" and "upvote" in one case, "otherclass" and "novote" in the other.

LSerni
  • 55,617
  • 10
  • 65
  • 107