Thursday, April 16, 2009

How to cause 'div' to behave like a button

Our graphics guys decided that is it a neat idea to use divs instead of normal html buttons at bugsondemand.com. Actually, I prefer buttons but hey.. I'm a stupid man , I would never appreciate a masterpice , a top of the design for me is google.com just boring input and two buttons..

Anyway if you want to let your divs to behave like buttons when the mouse passes over, you need to change the mouse cursor to the pointer

This is how it is done :


<div id="BuyCredits2" style="this.style.cursor='pointer'">
<label style="this.style.cursor='pointer'">Buy Credits</label>
</div>


There are some more pointer options

  • default
  • auto
  • crosshair
  • hand
  • wait
  • help
  • text
  • move
  • n-resize
  • s-resize
  • e-resize
  • w-resize
  • ne-resize
  • nw-resize
  • se-resize
  • sw-resize
  • pointer

No comments:

Post a Comment