User
User

Reputation: 171

What's up with my transition not working?

When creating this button, I want it to have a gradient transition when active, but it seems it it isn't working and I can't figure out why. Google Chrome does not block the property's but they just seem to do nothing..

This is what the button looks like:

 .button {
    color: #fff !important;
    font-size: -63px;
    font-family: "CentraleSans-Bold","Helvetica Neue",Helvetica,Arial;
    line-height: 265%;
    text-decoration: none;
    background-color: #167de4;
    padding: 0 20px;
    display:inline-block;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    -ms-border-radius: 3px;
    -o-border-radius: 3px;
    border-radius: 3px;
    -webkit-background-clip: padding;
    -moz-background-clip: padding;
    border: 1px solid #1d4ea4;
    -moz-box-shadow: 0 1px 1px rgba(0,0,0,0.23),inset 0 1px 0 rgba(255,255,255,0.19);
    background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #3669ef), color-stop(100%, #4f95f4));
    background-image: -webkit-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: -moz-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: -o-linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    background-image: linear-gradient(bottom, #3669ef 0%,#4f95f4 100%);
    text-shadow: 0 1px 2px rgba(0,0,0,0.75);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    vertical-align: middle;
    }

And this is what the transition looks like:

a{
-webkit-transition: all 0.05s ease-in-out;
-moz-transition: all 0.05s ease-in-out;
-o-transition: all 0.05s ease-in-out;
transition: all 0.05s ease-in-out;
}

The HTML looks like this:

<a class="button" href="#" style="opacity: 1;">Create an account</a>

Thanks for your help :)

Upvotes: 1

Views: 130

Answers (2)

Kevin Lynch
Kevin Lynch

Reputation: 24723

You need to add .button:active

DEMO http://jsfiddle.net/kevinPHPkevin/dfw8B/

.button:active {
      background:red;   
}

Upvotes: 1

robtarr
robtarr

Reputation: 76

Can you add your HTML to the question? You have the gradient on a 'button', but the transition on an 'a'.

Upvotes: 2

Related Questions