Anybody, about extern the css pseudo class :)

Anybody, about extern the css pseudo class :)

I want use a custom anchor with icon in my page,
but i cannot using "background" in anchor tag directly because im using a sprite,the code like this:

  1. // html
  2. <a href="#c1" icon="icon1">icon link1</a>
  3. <a href="#c2" icon="icon2">icon link2</a>

  4. // css
  5. ins{width:16px; height:16px; background-image:sprite.png; background-repeat: no-repeat;}

  6. .icon1{background-position:0 0}
  7. .icon1:hilight{background-position:0 -16}
  8. .icon2{background-position:-16 0}
  9. .icon2:hilight{background-position:-16 -16}

  10. // js
  11. $(document).ready(function()
  12. {
  13. $('a[icon]').each(function()
  14. {
  15. var iconclass = $(this).attr('icon');
  16. $(this).prepend('<ins class="'+iconclass +'"></ins>');
  17. $(this).removeAttr('icon');
  18. }
  19. }

I want: when i mouseover the link, the icon can " hilight", many thanks for your help!