<div class="container"> <div class="row"> <div class="hidden-xs col-lg-4 col-md-6 col-sm-12 col-xs-12"> Some text here. </div> </div>
解决方法
“究竟什么是隐藏的-sm-DOWN?”
它不再存在于beta中,但它之前的版本意味着“隐藏在小而小”.含义,隐藏在xs和sm上,但在其他方面可见.
如果要在Bootstrap 4中的特定层(断点)上隐藏元素,请相应地使用d- * display类.请记住,xs是默认(始终隐含)断点,除非被更大的断点覆盖.由于暗示了xs,因此不再使用-xs-中缀.例如,它不是d-xs-none,它只是d-none.
https://www.codeply.com/go/bRlHp8MxtJ
> hidden-xs-down = d-none d-sm-block
> hidden-sm-down = d-none d-md-block
> hidden-md-down = d-none d-lg-block
> hidden-lg-down = d-none d-xl-block
> hidden-xl-down = d-none(与隐藏相同)
> hidden-xs-up = d-none(与隐藏相同)
> hidden-sm-up = d-sm-none
> hidden-md-up = d-md-none
> hidden-lg-up = d-lg-none
> hidden-xl-up = d-xl-none
> hidden-xs(only)= d-none d-sm-block(与hidden-xs-down相同)
> hidden-sm(only)= d-block d-sm-none d-md-block
> hidden-md(only)= d-block d-md-none d-lg-block
> hidden-lg(only)= d-block d-lg-none d-xl-block
> hidden-xl(仅)= d-block d-xl-none
> visible-xs(only)= d-block d-sm-none
> visible-sm(only)= d-none d-sm-block d-md-none
> visible-md(only)= d-none d-md-block d-lg-none
> visible-lg(only)= d-none d-lg-block d-xl-none
> visible-xl(仅)= d-none d-xl-block
Demo of all hidden / visible classes in Bootstrap 4 beta
另请注意,d – * – block可以替换为d – * – inline,d – * – flex等.取决于元素的显示类型.更多关于display classes in beta
另见:
Bootstrap 4 hidden-X-(down/up) class not working
Missing visible-** and hidden-** in Bootstrap v4