<div class="box news-box"></div>
<sass>
.box{
padding:20px;
border:1px solid #333;
}
.news-box{
@extend .box;
background-color:#eee;
}
.list-box{
@extend .box;
background-color:#000;
}
<css>
.box, .news-box, .list-box { padding: 20px; border: 1px solid #333; }
.news-box { background-color: #eee; }
.list-box { background-color: #000; }
/* -------------------------------------------------------------------- */
// placeholder selector
<sass>
%box{
padding:20px;
border:1px solid #333;
}
.news-box{
@extend %box;
background-color:#eee;
}
.list-box{
@extend %box;
background-color:#000;
}
<css>
.news-box, .list-box { padding: 20px; border: 1px solid #333; }
.news-box { background-color: #eee; }
.list-box { background-color: #000; }
<scss>
@mixin ellipse-one($wid){
width:$wid;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
.text{
@include ellipse-one(80%);
}
//css
.text { width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
<sass>
#header {
h1 {
font-size: 26px;
font-weight: bold;
}
p { font-size: 12px;
a { text-decoration: none;
&:hover { border-width: 1px }
}
}
}
<css>
#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;
}
<sass>
.fakeshadow {
border: {
style: solid;
left: {
width: 4px;
color: #888;
}
right: {
width: 2px;
color: #ccc;
}
}
<css>
.fakeshadow {
border-style: solid;
border-left-width: 4px;
border-left-color: #888;
border-right-width: 2px;
border-right-color: #ccc;
}
$base-url: "https://taegon.kim"; /* SASS */
h1 { background:url("#{$base-url}/images/bg.png"); } /* SASS */
h1 { background:url(#{$base-url});
h1 { background:url($base-url);}
h1 { background:url($base-url + "/images/bg.png"); } /* SASS */
@for $i from 1 through 5 { .text-#{$i} { font-size : $i*10px; } }
.text-1 {font-size : 10px;}
.text-2 {font-size : 20px;}
.text-3 {font-size : 30px;}
.text-4 {font-size : 40px;}
.text-5 {font-size : 50px;}
$type: monster;
p {
@if $type == ocean {
color: blue;
} @else if $type == matador {
color: red;
} @else if $type == monster {
color: green;
} @else {
color: black;
}
}
p { color: green; }
비구조화 할당을 이용하면 리액트에서 this.state나 this.props를 미리 지정해두어 반복 사용없이 사용 가능하다.
var kim = {name:'kim', first:10, second:20}
var lee = {name:'lee', first:10, second:10}
function sum(prefix){
return prefix+(this.first+this.second);
}
// sum();
console.log("sum.call(kim)", sum.call(kim, '=> '));
console.log("lee.call(kim)", sum.call(lee, ': '));
var kimSum = sum.bind(kim, '-> ');
console.log('kimSum()', kimSum()); // kimSum() -> 30
import {a as b} from '경로' // a 를 b로 변경한다.
import {namedA, namedB} from '경로'
export default class NamedC extends Component{}