SASS(SCSS) Tutorial #2

· 2019-02-26 (화) 00:22:48 · 1332

7. Pseudo Classes

#main-nav a:hover {

  background: #333;

}

는 다음과 같이 

a{

  &:hover{

    background: #333;

  }

}

float후에 사용되는 아래와 같은 것도 mixin으로 처리한후에 사용함.

@mixin clearFix{

  &:after{

    content: "";

    display: block;

    clear: both;

  }

}

8. Mathematical Operators

*, /, +, - 를 사용가능함.

width: (100% / 6) 

9. Creating a Grid with SASS Math

mixin과 math를 이용해서 grid를 자동으로 설정가능함.   동영상을 꼭보세요.

sass의 장점이 여기에서 나오기 시작합니다.

 

@mixin grid($cols, $mgn) {
    float: left;
    margin-right: $mgn;
    margin-bottom: $mgn;
    width: ((100% - (($cols - 1) * $mgn)) / $cols);
    &:nth-child(#{$cols}n) {
        margin-right: 0;
    }
}

 

10. Colour Functions

http://sass-lang.com/documentation/Sass/Script/Functions.html

 

lighten($deepBlue, 5)

complement($deepBlue)

 

11. The @Content Keyword

@content 는 말로 설명하기 어려우니 동영상을 꼭 보세요.

 

12. If Statements

멀티불 인자를 넘겨줄수도 있습니다.

@mixin mQ($arg...){
    @if length($arg) == 1{
        @media screen and (max-width: nth($arg, 1)){
            @content;
        }
    }
    @if length($arg) == 2{
        @media screen and (max-width: nth($arg, 1) and (min-width: nth($arg, 2))){
            @content;
        }
    }
}

 

 

 

|
댓글을 작성하시려면 로그인이 필요합니다.

CSS

89건

CSS 관련 공부 및 자료 공유 소모임 게시판 입니다.

+
제목 글쓴이 날짜 조회
19-05-11 조회 1,829
19-04-29 조회 1,780
19-04-03 조회 1,752
19-02-28 조회 2,002
19-02-28 조회 2,122
19-02-27 조회 1,585
19-02-27 조회 2,958
19-02-27 조회 1,734
19-02-26 조회 1,648
19-02-26 조회 1,333
19-02-26 조회 2,560
19-02-25 조회 1,568
19-02-25 조회 1,508
19-02-25 조회 1,303
19-02-24 조회 1,682
19-02-24 조회 1,219
19-02-24 조회 1,420
19-02-23 조회 1,326
19-02-23 조회 1,629
19-02-23 조회 2,165
19-02-22 조회 1,590
19-02-22 조회 1,513
19-02-22 조회 1,787
19-02-21 조회 1,662
19-02-21 조회 1,317
19-02-21 조회 1,790
19-02-20 조회 1,180
19-02-20 조회 1,107
19-02-20 조회 1,074
19-02-19 조회 1,341