html - 手写笔:@media screen and (max-width: 425px) 阻止手写笔创建 css

标签 html css stylus

我刚开始使用 Stylus 编写 CSS,但遇到了一个问题。

我想根据最大宽度更改我的 CSS。为此,我使用 @media 屏幕和(最大宽度:xyzpx)。这通常对我来说很好。 在我的 style.styl 文件中,我多次使用上面的内容,但是当我输入最后一个时,浏览器只打开纯 html 文件,根本不使用 .styl 文件。

这是我的代码:

@media screen and (max-width: 425px)
  header 
    height 110px
    background-image url(/images/banner_425.jpg)
    a
        &.logo
        height 36px 
        background rgba(0,0,0,.65) url(/images/logo_small.svg) no-repeat center center
        background-size 126px 17px 

    .hero 
        width 100% 
        left 0 
        top 46px 
        text-align center 

        h1 
            font-size 1em
            margin-bottom 10px 

        a
            &.btn 
                padding 2px 30px 
                font-size .8em
                span 
                    display none 

最佳答案

你有一个缩进错误。

    &.logo
    height 36px 
    background rgba(0,0,0,.65) url(/images/logo_small.svg) no-repeat center center
    background-size 126px 17px

应该是:

&.logo
    height 36px 
    background rgba(0,0,0,.65) url(/images/logo_small.svg) no-repeat center center
    background-size 126px 17px

但总的来说,我强烈建议使用 Rupture用于 Stylus 中的媒体查询

关于html - 手写笔:@media screen and (max-width: 425px) 阻止手写笔创建 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34151856/

相关文章:

javascript - 使用 Javascript 读取 CSS 文字值

javascript - 使表格可滚动

javascript - KnockoutJs 组件 - 添加默认类

javascript - 如何聚焦 HTML 表格中的行?

c# - 通过单击指向子页面的母版页超链接获取值

一个单元格的 HTML 表格动态高度

javascript - 使用 CSS 对数字进行四舍五入并以红色或绿色显示数字

css - 如何创建一个与变量值同名的mixin?

html - 在 IE9 中未从打印中删除按钮元素

css - 为什么我的部门在那里?