以下のSASS関数をどのように組み合わせることができるかについて、誰かが私にアドバイスできるかどうか疑問に思っていました. if ( $property == 'ie' ) のような追加のパラメーターを使用して if..else ステートメントを追加しようとしましたが、成功しませんでした。
機能:
// To use width, margin, padding...
@function percentageWidth( $elementWidth, $containerWidth ){
@return $elementWidth/$containerWidth * 100%;
}
// To use *width ie6/7 workarounds
@function iePercentageWidth( $elementWidth, $containerWidth ){
@return $elementWidth/$containerWidth - 0.5/$containerWidth * 100%;
}
現在の CSS:
width: percentageWidth( 214,945 );
*width: iePercentageWidth( 214,945 );
次のようなものにもこの関数を使用したいと思います。
margin: percentageWidth( 23,945 );