scss 继承extend

@extend 选择器
d.html


<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>scss extend继承title>
    <link rel="stylesheet" type="text/css" href="../css/d.css">
head>
<body>
    <div class="box">div>
    <div class="box-red">div>
body>
html>

d.scss

.box {
  width: 100px;
  height: 100px;
  background: #e8e8e8;
}

.box-red {
  @extend .box;
  border: 1px solid;
}

d.css

.box, .box-red {
  width: 100px;
  height: 100px;
  background: #e8e8e8; }

.box-red {
  border: 1px solid; }

/*# sourceMappingURL=d.css.map */

你可能感兴趣的:(前端)