2017-01-29 16 views

答えて

1

あなたが背景としてグラデーションを使用し、50%の最初の色を停止し、50%で第二を開始することができます。

button { 
 
    background: -webkit-linear-gradient(blue 50%, red 50%); 
 
    background: linear-gradient(to right, blue 50%, red 50%); 
 
    background: -o-linear-gradient(blue 50%, red 50%); 
 
    background: -moz-linear-gradient(blue 50%, red 50%); 
 
    -webkit-appearance: \t none; 
 
    appearance: \t none; 
 
    border: none; 
 
    font-size: 15px; 
 
    color: #FFF; 
 
    padding: 8px 16px; 
 
}
<button>Button</button>

グラデーションの角度を変更したい場合方向はほんの始まりにXdegを使用します。

button { 
 
    background: -webkit-linear-gradient(-60deg, blue 50%, red 50%); 
 
    background: linear-gradient(-60deg, blue 50%, red 50%); 
 
    background: -o-linear-gradient(-60deg, blue 50%, red 50%);; 
 
    background: -moz-linear-gradient(-60deg, blue 50%, red 50%);; 
 
    -webkit-appearance: \t none; 
 
    appearance: \t none; 
 
    border: none; 
 
    font-size: 15px; 
 
    color: #FFF; 
 
    padding: 8px 16px; 
 
}
<button>Button</button>

+0

はいまったく同じです。私はこれを使用しましたが、私はその水平分離を60度に向けるようにする必要があります。 – Gautham

+0

このように?バックグラウンド:直線勾配(60deg、青色50%、赤色50%)。 – TheYaXxE

0

このような?

button{ 
 
    background: -webkit-linear-gradient(left, blue 50%, red 50%); /* For Safari 5.1 to 6.0 */ 
 
    background: -o-linear-gradient(right, blue 50%, red 50%); /* For Opera 11.1 to 12.0 */ 
 
    background: -moz-linear-gradient(right, blue 50%, red 50%); /* For Firefox 3.6 to 15 */ 
 
    background: linear-gradient(to right, blue 50%, red 50%); /* Standard syntax */ 
 
}
<button>Click here</button>

関連する問題