手写笔CSS混音不工作
我使用定位混合器将我的div对齐到页面的顶部、左侧或中心等位置,它与scs和Sass配合得很好,但由于某些原因,当我尝试使用手写笔时,它的行为非常奇怪 如果我包含一个Mixin,它可以正常工作,但当我在下面添加更多Mixin时,它将默认为另一个Mixin 我的Mixin示例:手写笔CSS混音不工作,css,mixins,stylus,css-preprocessor,Css,Mixins,Stylus,Css Preprocessor,我使用定位混合器将我的div对齐到页面的顶部、左侧或中心等位置,它与scs和Sass配合得很好,但由于某些原因,当我尝试使用手写笔时,它的行为非常奇怪 如果我包含一个Mixin,它可以正常工作,但当我在下面添加更多Mixin时,它将默认为另一个Mixin 我的Mixin示例: top() position absolute margin auto top 0 right 0 //bottom 0 left 0 一些理论: 它结合了我的声明 手写笔不知道我
top()
position absolute
margin auto
top 0
right 0
//bottom 0
left 0
一些理论:
- 它结合了我的声明
- 手写笔不知道我在呼叫哪个混音器
提前感谢您的帮助 您缺少mixin指示器
-
。这应该适合您:
// this is the mixin I'm calling, it positions the div to the top
-top()
position: absolute
margin: auto
top: 0
right: 0
left: 0
// for some reason the div is defaulting to this mixin instead
-center()
position: absolute
margin: auto
top: 0
right: 0
bottom: 0
left: 0
// if you comment this block out it will work normally, calling the top() mixin only
-left()
position: absolute
margin: auto
top: 0
bottom: 0
left: 0
// my div calling top()
.block
-top()
background: #345
width: 100px
height: 100px
您缺少混音指示器
-
。这应该适合您:
// this is the mixin I'm calling, it positions the div to the top
-top()
position: absolute
margin: auto
top: 0
right: 0
left: 0
// for some reason the div is defaulting to this mixin instead
-center()
position: absolute
margin: auto
top: 0
right: 0
bottom: 0
left: 0
// if you comment this block out it will work normally, calling the top() mixin only
-left()
position: absolute
margin: auto
top: 0
bottom: 0
left: 0
// my div calling top()
.block
-top()
background: #345
width: 100px
height: 100px
问题是。您正在定义left()
mixin并在top()
mixin中使用它:
left 0 -> left(0)
最好不要在手写笔中使用CSS属性名作为mixin的名称。问题是。您正在定义left()
mixin并在top()
mixin中使用它:
left 0 -> left(0)
最好不要在手写笔中使用CSS属性名作为mixin的名称。为什么
右
和左
在top()内部都等于0
?不应该只有top()
只有top 0
?这是我的黑客定位方式,如果你想让某个东西与顶部对齐,那么你就忽略底部;如果你想让某个东西与左侧对齐,那么你就忽略右侧,如果你想让它居中,你就把它们都保持住为什么右
和左
都等于0
在top()的内部?不应该只有top()
只有top 0
?这是我的黑客定位方式,如果你想让某个东西与顶部对齐,那么你就忽略底部;如果你想让某个东西与左侧对齐,那么你就忽略右侧;如果你想让它居中,那么你就让它们都保持不动,-
不是混音所必需的。@Panya-那么为什么现在可以这样做呢?因为-left
未在-top
混音中使用。请看下面我的答案。是的,这是有道理的<代码>-左!=左图
我正在查看他们网站上“Try Stylus”中的示例,看起来很多混音都是从-
开始的。必须以这种方式描述,以尝试并防止这个确切的问题。不,-
对于混音来说不是必需的。@Panya-那么为什么现在可以这样做呢?因为-left
未在-top
混音中使用。请看下面我的答案。是的,这是有道理的<代码>-左!=左图
我正在查看他们网站上“Try Stylus”中的示例,看起来很多混音都是从-
开始的。必须以这种方式描述,以尝试和防止这个确切的问题。这也修复了错误,谢谢@Panya-我希望我能选中这两个透明的混合是导致这个错误的真正原因。@J.Titus的答案只是一个解决方法:)这也修复了这个bug,谢谢@Panya-我希望我能选中这两个透明的混入是导致这个bug的真正原因。@J.Titus的答案只是一个解决办法:)