728x90
모바일 썸네일 background-image방식
가로크기가 항상 100%가 아닐경우도 있어서
매개변수로 퍼센트값, 가로,세로 받아서 mixin으로 계산
// 썸네일 세로 %구하기
@mixin ratioWidth ($percentW, $width, $height){
height:0;
padding-bottom: (($height*$percentW)/$width) + %;
}
.item {
$width : 50;
width: $width + %;
@include ratioWidth($width,370,446);
}
728x90
'STUDY > CSS' 카테고리의 다른 글
| 좌 우 요소 상하 중앙 정렬 (0) | 2019.11.05 |
|---|---|
| 리스트 빈칸 채우기 (0) | 2019.07.05 |
| rem 계산기 (0) | 2019.07.05 |
| css로 요소 개수 알아내기 (0) | 2019.07.05 |
| css animation 값 유동적으로 적용 (0) | 2019.07.05 |