2

CSS3 トランジションでボタンの色を変更できないようです。ラウンドアバウトの同じコードとタグを使用して成功しましたが、ボタンではそのような運はありません。

コードは次のとおりです。

.button {
    position:absolute;
    width: 135px;
    height: 46px;
    background-color: #ef6529;
    text-decoration: none;
    border-radius: 4px;
    -moz-border-radius: 4px;
    border: 1px solid #c33b00;
    box-shadow: 0px 4px 0px #af5a5a;
    -moz-box-shadow: 0px 4px 0px #af5a5a;
    -webkit-box-shadow: 0px 4px 0px #af5a5a;
    -webkit-transition:color 1s ease-in;  
    -moz-transition:color 1s ease-in;  
    -o-transition:color 1s ease-in;  
    transition:color 1s ease-in;
}

.button:hover {
    width: 135px;
    height: 46px;
    background-color: #ff6726;
    border-radius: 4px;
    -moz-border-radius: 4px;
    border: 1px solid #c33b00;
    text-decoration: none;
}

そしてHTML:

<a href="#" class="button">
    <!--<h2>PUSH ME!</h2>-->
</a>

乾杯!

4

1 に答える 1

1

ボタンの色が指定されていません。挿入された背景色を移行したいと思います。に変更transition:color 1s ease-in;するだけtransition: background-color 1s ease-in;です。

于 2013-03-17T16:03:59.403 に答える