728x90
반응형
728x90
반응형

sticky vs fixed

fixed : 스크롤을 해도 해당 위치에 위치한다

position:fixed;
bottom:0;

위 처럼 적용시 처음에 로드시 bottom :0 에 붙지만, 스크롤을 영향을 받지 않아서,
스크롤을 내리면 fixed 인데도 위에 붙어 있는 현상이 된다.

sticky : 스크롤에 따라 위치한다

position:sticky;
bottom:0;

위 처럼 적용 시 fixed 와 달리 스크롤을 내릴때도 해당 bottom:0 을 계속 적용한다.

728x90
반응형

'front-end > CSS & SCSS' 카테고리의 다른 글

vue3 vite css sourcemap 설정  (0) 2023.06.13
@at-root 의 사용법  (0) 2023.06.13
여러개의 모드(다크,민트등) SCSS 제작 방식  (0) 2023.06.13
flex or grid  (0) 2023.06.13
List 와 map 의 차이  (0) 2023.06.13
728x90
반응형

List는 하나의 변수에 여러값을 담을수 있다.

each문으로 출력한다.

@mixin List_Test($property, $value) {
    $prefixes: webkit, moz, ms, o;
    @each $prefix in $prefixes {
        #{'-' + $prefix + '-' + $property}: $value;
    }
    // 기본
    #{$property}: $value;
}

Map 은 key와 value 가 세트다. json 형태로 생각하면 된다.

$Map_test :(
    "인사":"hello",
    color:#000,
    "margin":"20px"
);
@each $name, $val in $Map_test {
    .map_test {
      #{$name} : $val; 
    }
}

scss -> css 빌드

.map_test {
  인사: "hello";
}
.map_test {
  color: #000;
}
.map_test {
  margin: "20px";
}

MAP 2개 이상 사용시

기본은 기본값이 있고, 그외의 값 사용시 따른값 출력한다

$Map_test :(
    first : (
        "인사":"hello",
        color:#000,
        "구매":"레몬"
    ),
    second:(
        "인사":"안녕",
        color:red,
        "구매":"딸기"
    )
);

@function mapFunc($key,$type:"first"){
    @each $name, $val in map-get($Map_test,$type){
      @if($key == $name){
        @return $val;
      }
    }
}

@mixin map-test($property,$type){
    #{$property}: mapFunc($type);
    @at-root body & .abc .edf & &{ // & 는 
        #{$property}: mapFunc($type,second);
    }
}

.MAP_TEST{
    @include map-test(color,"구매")
}
728x90
반응형

'front-end > CSS & SCSS' 카테고리의 다른 글

vue3 vite css sourcemap 설정  (0) 2023.06.13
@at-root 의 사용법  (0) 2023.06.13
여러개의 모드(다크,민트등) SCSS 제작 방식  (0) 2023.06.13
flex or grid  (0) 2023.06.13
sticky vs fixed  (0) 2023.06.13

+ Recent posts

728x90
반응형