css, change less variable with @media

后端 未结 2 1385
时光说笑
时光说笑 2020-12-11 01:52

I\'m currently on a site project that is responsive and less is really helping out a lot.

But I want a size variable to change depending on window size. I\'ve tried

2条回答
  •  情歌与酒
    2020-12-11 02:33

    yes but in that way you must rewrite all

    the best way should be (but it doesnt work)

    @w : 10px
    
    @media (min-width: 1440px) {
    
        @w:500px;
    
    }
    @media (min-width: 1024px) and (max-width: 1280px) {
    
    @w:300px;
    
    }
    
    @media (min-width: 800px) and (max-width: 1020px) {
    
        @w:200px;
    }
    
    .any{
            width:@w;
        }
    

提交回复
热议问题