Инструменты пользователя

Инструменты сайта


web_designe:sass:mixin

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
web_designe:sass:mixin [2020/01/26 17:44]
werwolf
web_designe:sass:mixin [2023/01/12 12:18] (текущий)
Строка 187: Строка 187:
  
  
-<sxh scss; title: index.scss>​+<sxh scss;highlight:​2;  ​title: index.scss>​
 .test2{//​Именованные параметры .test2{//​Именованные параметры
    ​@include block($radius:​ 20px);    ​@include block($radius:​ 20px);
Строка 196: Строка 196:
  
  
-<sxh scss; title: _minixs.scss>​+<sxh scss;highlight:​5;  ​title: _minixs.scss>​
 @mixin rounded($radius){ @mixin rounded($radius){
   border-radius:​ $radius;   border-radius:​ $radius;
Строка 208: Строка 208:
  
  
-<sxh css; title: index.css>​+<sxh css; highlight:​3-4; title: index.css>​
 .test2 { .test2 {
   border-radius:​ 20px;   border-radius:​ 20px;
Строка 215: Строка 215:
   height: 500px; }   height: 500px; }
 </​sxh>​ </​sxh>​
 +====оператором рест====
  
 +
 +<sxh scss; highlight:​2;​ title: index.scss>​
 +.test4{//​Миксин с оператором рест
 +  @include box-shadow(1px 1px 1px #eee, 2px 2px 2px black);
 +}
 +</​sxh>​
 +
 +
 +<sxh scss;​highlight:​1;​ title: _minixs.scss>​
 +@mixin box-shadow($shadows...){//​Оператор рест
 +  box-shadow: $shadows;
 +}
 +</​sxh>​
 +<sxh css; title: index.css>​
 +.test4 {
 +  -webkit-box-shadow:​ 1px 1px 1px #eee, 2px 2px 2px black;
 +          box-shadow: 1px 1px 1px #eee, 2px 2px 2px black; }
 +</​sxh>​
 +====подключение @content====
 +Существует возможность передачи блока стилей в миксин,​ которые будут расположены среди стилей,​ подключаемых этим миксином. Эти стили будут размещены вместо директив @content, расположенных внутри миксина. Это даёт возможность создания абстракций,​ зависящих от конструкций селекторов или директив. Например: ​
 +
 +<sxh scss; title: index.scss>​
 +@import "​minixs";​
 +ul{
 +    @include apply-ly{
 +      text-decoration:​ underline;
 +      padding: 5px;
 +      color: blue;
 +    }
 + }
 +</​sxh>​
 +
 +
 +
 +<sxh scss; title: _minixs.scss>​
 +@mixin apply-ly{
 +  li{
 +    font-weight:​ bold;
 +    @content;
 +  }
 +}
 +</​sxh>​
 +
 +
 +
 +<sxh css; title: index.css>​
 +ul li {
 +  font-weight:​ bold;
 +  text-decoration:​ underline;
 +  padding: 5px;
 +  color: blue; }
 +</​sxh>​
web_designe/sass/mixin.1580049875.txt.gz · Последние изменения: 2023/01/12 12:17 (внешнее изменение)