I am trying to use gradient style for my buttons, but, I have a problem with hover style, Here is the button before hover:
And here is after hover:
Here is haml of button:
= link_to '#', {:class=>'tour_btn btn btn-large btn-primary', :style=>'margin-left: 10px; width: 105px;'} do
%h3
Take a Tour
LESS:
.tour_btn {
#gradient > .vertical(#F98C51, #a35b35);
}
Any idea please ? is it possible to specify another gradient style for hover state ? Or at least, not to change button when hover ?
you can specify what you want the CSS to be when a button is hovered with the css :hover property.
So in your case you will want to do something like
Using chrome developer tools you should be able to see what kind of gradients are currently being applied by bootstrap and then override them with your css.
Twitter Bootstrap animates the
background-position
on hover with a transition (since background-gradients cant have a transition). What is happening in your case, is the background-gradient is getting shifted up withbackground-position: -15px
, and you are seeing the background-color underneath.To fix this set your
background-color
to the bottom color of your button gradient on hover:If you have a set a background image for a button, the background shifts up by
15px
on hover. You can set it to0px
.i found this solution you can try this . it works with simple code
When using custom css instead of LESS to style your buttons, try http://twitterbootstrapbuttons.w3masters.nl/?color=%23F1874E. You will get all css for your custom buttons including hover effect and disabled / active states.
For the button above you could use possible:
usage:
Add the CSS below /after your bootstrap(.min).css Using this css let's you custom button effects work in most browsers.