简体   繁体   English

手写笔:@media屏幕和(最大宽度:425px)可防止手写笔创建CSS

[英]Stylus: @media screen and (max-width: 425px) prevents stylus from creating css

I've just started coding my CSS with Stylus and I've got one problem. 我刚刚开始用Stylus编码CSS,但遇到了一个问题。

I'd like to change my CSS depending on the max-width. 我想根据最大宽度更改CSS。 For this I use @media screen and (max-width: xyzpx). 为此,我使用@media屏幕和(最大宽度:xyzpx)。 Which normally works fine for me. 通常对我来说很好。 In my style.styl file I use the above multiple times, but when I enter my the last one, the browser just opens the plain html file and does not use the .styl file at all. 在我的style.styl文件中,我多次使用以上内容,但是当我输入最后一个文件时,浏览器只会打开纯HTML文件,而根本不使用.styl文件。

Here is my code: 这是我的代码:

@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 

You have an indentation error. 您有缩进错误。

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

Should be: 应该:

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

But in general I would strongly recommend using Rupture for media queries in Stylus 但总的来说,我强烈建议您在Stylus中使用Rupture进行媒体查询

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让@media(max-width 425px) 单独工作,而不是跟随@media(max-width 768px) - How to get @media(max-width 425px) to work alone, and not follow @media(max-width 768px) @media 屏幕和 (max-width:768px) 不起作用 - @media screen and (max-width:768px) not working 在更大的设备上预览CSS @Media屏幕(最大宽度) - Preview css @media screen (max-width) on bigger device CSS-媒体查询的最大宽度设置为以729px隐藏div但以657px隐藏 - CSS - Media Query max-width set to hide div at 729px but hides at 657px 如何在媒体屏幕上固定和居中图像@media(最大宽度:480px) - How to fixed and center image on media screen @media (max-width: 480px) Nexus 7 screen.width返回800,但媒体查询max-width:720px仍然适用 - Nexus 7 screen.width returns 800 but media query max-width: 720px still applies 添加@media only screen 和(最大宽度:1000px)代码会中断吗? - When adding @media only screen and (max-width: 1000px) the code breaks? @media屏幕和(max-width:800px)不起作用,整个Internet上都在看 - @media screen and (max-width:800px) not working, looked all over the internet 文字在@media屏幕上居中对齐,并且(min-width:992px)和(max-width:1199px) - text not aligns to centers on @media screen and (min-width:992px) and (max-width:1199px) 媒体查询不适用于最大宽度的屏幕尺寸(640像素) - Media query not working with max-width screen size (640px)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM