2016-08-16 15 views
0

私はSassを習得していますが、ブラウザの互換性で境界の半径を25pxに設定してエラーが発生するようにしたいとします。どんな助けもありがとう。Sassに複数のcssプロパティを持つ変数を書き込む方法

$red: #F00; 
 

 
$border-radius: 
 
      -webkit-border-radius:25px; 
 
       -moz-border-radius:25px; 
 
        border-radius:25px;
h5 { 
 
    font-size: 12px; 
 
    padding: 20px; 
 
\t border-radius: $border-radius; 
 
\t background: $red; 
 
}

答えて

1

ミックスインを使用してみてください。ここでMixin sectionからの例です:

@mixin border-radius($radius) { 
    -webkit-border-radius: $radius; 
    -moz-border-radius: $radius; 
     -ms-border-radius: $radius; 
      border-radius: $radius; 
} 

あなたがそうのようにこれを使用することができます:

h5 { 
    @include border-radius(25px); 
    font-size: 12px; 
    padding: 20px; 
    background: $red; 
} 
0

あなたはもH5にそのクラスを1クラスを定義して使用することができます。

.borderClass{ 
    -webkit-border-radius:25px; 
    -moz-border-radius:25px; 
    border-radius:25px; 
} 

h5 { 
font-size: 12px; 
padding: 20px; 
background: $red; 
.borderClass 
} 
関連する問題