Issue
What I want is the background color of a button to change from top to bottom on hover. There is a good example on this page http://tympanus.net/Development/CreativeButtons/ This is the code I have now. Thanks
CSS
#button {
outline: 0;
margin: 20px 10px 10px 6px;
border-width:2.7px;
font-size: 25px;
border-style: solid;
font-family: 'PT Sans Narrow', sans-serif;
padding: 4px 40px;
background-color: white;
border-color: #0e83cd;
color: #0e83cd;
transition: all .3s ease-in;
}
#button:hover {
color: white;
background-color: #0e83cd;
transition: all .3s ease-in;
}
HTML
<button id="button" />Ask</button>
Solution
there are lots of ways to do that. this css could help you.
#button {
/*Reset*/
display: inline-block;
outline: none;
background-color: transparent;
/*Some fancy stuff*/
padding: 0 20px;
line-height: 200%;
border: 1px solid silver;
/*Magic*/
background-image: linear-gradient(PaleVioletRed, PaleVioletRed 50%, Sienna 50%, Sienna);
background-size: 100% 200%;
-webkit-transition: background-position .3s;
transition: background-position .3s;
}
#button:hover {
background-position: 0 -100%;
}
Demo: http://codepen.io/theonebeing/pen/wMzYdY
Answered By - Ali Şahin Özçelik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.