css - Stylus 编译错误

标签 css stylus

各位,希望大家帮帮我。我已经开始设计风格,所有的东西都只有很少的网站 block 。但是当我开始为画廊编写 div 时(这里是它的代码)

body
    clearfix()
    text-align center
    background url('./bgh1.jpg') no-repeat center center fixed
    background-size(cover)

#gallery
    margin-left 6%
    width 88%
    display block
    margin-left auto
    margin-right auto
    height 500px
    background black

    #line1
        width 980px
        height 345px
        background #ffffff

        #col1
            width 500px
            height 500px
            border 2px solid black
            img
                max-width 100%
                max-height 100%

编译错误很多

#gallery {
  margin-left: 6%;
  width: 88%;
}
#gallery display block {
  margin-left: auto;
}
#gallery margin-right auto {
  height: 500px;
  background: #000;
}
#gallery margin-right auto #line1 width 980px {
  height: 345px;
  background: #fff;
}
#gallery margin-right auto #line1 #col1 {
  width: 500px;
  height: 500px;
  border: 2px solid #000;
}
#gallery margin-right auto #line1 #col1 img {
  max-width: 100%;
  max-height: 100%;
}

我一直在使用这个命令进行编译

stylus -w views/stylesheets/styl.styl -o views/style.css

最佳答案

参见 Selectors: Indentation :

Whitespace is significant [...]

您正在混合空格和制表符(即使在同一行)。即使这在您的编辑器中看起来不错,但当空格 很重要时,这可能会导致问题。因此,您应该将编辑器配置为用单个空格替换制表符以避免该问题。

关于css - Stylus 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41799427/

相关文章:

css - Emacs 24 : is there a way to use cc-mode's indentation?

css - 使用排水沟时如何防止柱子断裂,Jeet

html - 基于 Flexbox 的 CSS 无法在任何 iOS 浏览器上运行

css - Stylus 未将所有内容编译到一个 .styl 文件中

javascript - 主页文本区域更改

html - 对于 thead tr,边框未按预期工作

node.js - 将 Stylus 文件输出到 express3 中的自定义目录

css - 创建具有多个类的 Stylus 变量并在编译中连接

javascript - 防止随机放置的元素重叠

javascript - 当按下光滑点时将事件类添加到外部按钮