Can both my flag as well as unflag text have different background images? I am using the Flag module to flag content and users on my site. In one of the nodes, i have attached a background image to the flag link. On clicking the link, the users also have the ability to unflag it. So on the unflag link i want another background image. Is it possible?
You can use a preprocess function to override the output as a span with classes. 

function MYMODULE_preprocess_flag(&amp;$variables) {
  $flag = &amp;$variables['flag'];
  $action = $variables['action'];
  if ($flag-&gt;name == 'drupal_like') {
    if ($action == 'flag') {
      $variables['link_text'] = '&lt;span class="flag flag-heart-light"&gt;&lt;/span&gt;';
    }
    else{
      $variables['link_text'] = '&lt;span class="flag flag-heart-dark"&gt;&lt;/span&gt;';
    }
  }
}


Then you can target these classes to write your css as David mentioned.

.flag-heart-dark{
  background: transparent url('images/flag.png') no-repeat;
}

.flag-heart-light{
  background: transparent url('images/unflag.png') no-repeat;
}