"Less"의 두 판 사이의 차이

2번째 줄: 2번째 줄:
;Leaner CSS; LESS
;Leaner CSS; LESS
* 동적 스타일시트 언어
* 동적 스타일시트 언어
* 브라우저가 LESS.js을 통해 실시간 컴파일 가능
* CSS 전처리기
* 브라우저가 LESS.js을 통해 실시간 컴파일


https://upload.wikimedia.org/wikipedia/commons/4/40/Less.png
https://upload.wikimedia.org/wikipedia/commons/4/40/Less.png

2014년 12월 21일 (일) 10:36 판

1 개요

Leaner CSS; LESS
  • 동적 스타일시트 언어
  • CSS 전처리기
  • 브라우저가 LESS.js을 통해 실시간 컴파일

 

2 변수

@color: #4D926F;
 
#header {
  color: @color;
}
h2 {
  color: @color;
}
#header {
  color: #4D926F;
}
h2 {
  color: #4D926F;
}

3 Mixin

.rounded-corners (@radius: 5px) {
  border-radius: @radius;
  -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
}
 
#header {
  .rounded-corners;
}
#footer {
  .rounded-corners(10px);
}
#header {
  border-radius: 5px;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
}
#footer {
  border-radius: 10px;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
}

4 중첩

#header {
  h1 {
    font-size: 26px;
    font-weight: bold;
  }
  p { 
    font-size: 12px;
    a { 
      text-decoration: none;
      &:hover { 
        border-width: 1px;
      }
    }
  }
}
#header h1 {
  font-size: 26px;
  font-weight: bold;
}
#header p {
  font-size: 12px;
}
#header p a {
  text-decoration: none;
}
#header p a:hover {
  border-width: 1px;
}

5 연산자

@the-border: 1px;
@base-color: #111;
@red:        #842210;
 
#header {
  color: @base-color * 3;
  border-left: @the-border;
  border-right: @the-border * 2;
}
#footer { 
  color: @base-color + #003300;
  border-color: desaturate(@red, 10%);
}
#header {
  color: #333;
  border-left: 1px;
  border-right: 2px;
}
#footer { 
  color: #114411;
  border-color: #7d2717;
}

6 같이 보기

7 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}