수색…
px을 (으)로 변환
px를 em 또는 rem으로 변환하려면 다음 함수를 사용할 수 있습니다.
@function rem-calc($size, $font-size : $font-size) {
$font-size: $font-size + 0px;
$remSize: $size / $font-size;
@return #{$remSize}rem;
}
@function em-calc($size, $font-size : $font-size) {
$font-size: $font-size + 0px;
$remSize: $size / $font-size;
@return #{$remSize}em;
}
$font-size
는 원래 글꼴 크기입니다.
예 :
$font-size: 14;
body {
font-size: #{$font-size}px;
font-size: rem-calc(14px); // returns 1rem
// font-size: rem-calc(28); // returns 2rem
}
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow