您的位置:首頁技術文章
文章詳情頁

css3 - sass中Mixins中each循環的問題

瀏覽:118日期:2023-08-05 15:14:24

問題描述

@mixin css3($property, $value) { @each $prefix in -webkit-, -moz-, -ms-, -o-, ’’ {#{$prefix}#{$property}: $value; }}@mixin css3after($property, $value) { @each $prefix in -webkit-, -moz-, -ms-, -o-, ’’ {$property: #{$prefix}#{$value}; }}header{ @include css3after(display,box);}.border_radius { @include css3(transition, 0.5s);}

為什么 .border_radius 的引用是成功的,但是 header的就是失敗的??

.border_radius成功后是這樣的:

.border_radius { -webkit-transition: 0.5s; -moz-transition: 0.5s; -ms-transition: 0.5s; -o-transition: 0.5s; transition: 0.5s; }

問題解答

回答1:

@mixin css3after($property, $value) { @each $prefix in -webkit-, -moz-, -ms-, -o-, ’’ {#{$property}: #{$prefix}#{$value}; }}

這樣試試,屬性名應該用這種形式

標簽: CSS
相關文章:
国产综合久久一区二区三区