tags:

views:

61

answers:

3

Hi,

Is it possible that when I move on the button mouse, change button styles?

When the cursor on the button, show this style:

input.button_p
{
   color: #000000;
   border-style: none;
}

When the cursor no't on the button, show this style:

input.button_a
{
   color: #FFFFFF;
   border-style:solid;
}

Thanks

+3  A: 
input.button {
  color: #000000;
  border-style: none;
}

input.button:hover {
  color: #FFFFFF;
  border-style:solid;
}

Note that the :hover attribute in this usage isn't support by all of the browsers.. But it is supported in enough of them to not worry about it.

Chris Lively
+7  A: 

You can use the :hover pseudo class, like this:

input.button_p {
  color: #000000;
  border-style: none;
}
input.button_p:hover {
  color: #FFFFFF;
  border-style:solid;
}

And the element just has the button_p class, like this:

<input type="button" class="button_p" />
Nick Craver
@Nick Craver: As far as i know, `:hover` doesn't work in IE6 for anything other than links.
Sarfraz
@sAc - So IE6 users miss out on a bit of *styling*...it's not functionally breaking at all, I think most would be perfectly alright with this. Think of the alternative, should we add JavaScript to do something CSS supports, making it heavier for every other browser, just to support something not even necessary for the site to function in IE6?
Nick Craver
@Nick Craver: Agreed that's what we have to live with, adding javascript will be overhead for such things. This is interesting though: http://stackoverflow.com/questions/2571073/ie6-hover-issue
Sarfraz
+1  A: 

<input type="submit"> and <input type="button"> are not styleable on all browsers. You should be using <button type="submit">text</button> instead.

jmz