繁体   English   中英

如何使用物化的css-order?

[英]How to use css-order with materialize?

我正在为我的反应项目使用materialize库。 当我使用col s12 l6样式时,我想在移动时更改col的顺序。 库中是否有默认值? 我读了一些关于pushpull东西,它不起作用,既没有将col包装在div也尝试使用order: 1 / order: 2样式。 有什么建议么?

// index.html

<div className="wrapper1">
    <div col s12 l6>
      some text
  </div>
</div>
<div className="wrapper2">
    <div col s12 l6>
      some more text
    </div>
</div>

// main.css

.wrapper1 {
    @media only screen and (max-width: $mobile) {
      order: 2
    }
}

.wrapper2 {
    @media only screen and (max-width: $mobile) {
      order: 1
    }
}

预期产量:

//on desktop

some text
some more text

//on mobile

some more text
some text

您的代码有太多错误。

我建议你先开始使用html和css的基础知识,然后再开始其他任何事情。

我已修改并更新了标记和媒体查询以修复所有错误。

 .wrapper { display: flex; flex-direction: column } @media only screen and (max-width: 767px) { .wrapper1 { order: 2 } .wrapper2 { order: 1 } } 
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <body> <div class="wrapper"> <div class="wrapper1"> <div class="col s12 l6"> some text </div> </div> <div class="wrapper2"> <div class="col s12 l6"> some more text </div> </div> </div> </body> 

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM