Html Bootstrap hidden-sm-down 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37764794/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 13:23:32  来源:igfitidea点击:

Bootstrap hidden-sm-down not working

htmlcsstwitter-bootstrap

提问by user1315621

I am using Boostrap 3. Why the <div>with hidden-sm-downis still visible when I resize the page on my laptop? I want to hide those two images on small devices in order to have a different menu.

我使用的自举3.为什么<div>hidden-sm-down仍是可见的,当我调整我的笔记本电脑的页面?我想在小型设备上隐藏这两个图像以获得不同的菜单。

<div class="row">                 
    <div class="col-md-7 left">
        <ul class="row">
            <li class="col-md-2">
                <a href="">Text</a>
            </li>
            <li class="col-md-2">
                <a href="">Text</a>
            </li>
            <li class="col-md-3">
                <a href="">Text</a>
            </li>
            <li class="col-md-3">
                <a href="">Text</a>
            </li>
            <li class="col-md-2">
                <a href="">Text</a>
            </li>
        </ul>
    </div>
    <div class="col-md-1 hidden-sm-down wave">
        <img src="img/ondina.png" />
    </div>
    <div class="col-md-3 right">
        <ul class="row">
            <li class="col-md-6">
                <a href="">Text</a>
            </li>
            <li  class="col-md-6">
                <a href="">Text</a>
            </li>
        </ul>
    </div>
    <div class="col-md-1 hidden-sm-down right-border">
        <img src="img/menu-right.png"  />
    </div>
</div>

回答by merkdev

Actually, hidden-sm-downwon't work with BS4

实际上,hidden-sm-down不适用于 BS4

With BS4, display utility classes are completely changed. Use this format instead;

使用 BS4,显示实用程序类完全改变。改用这种格式;

.d-{breakpoint}-{value}

More information ; https://getbootstrap.com/docs/4.0/utilities/display/

更多信息 ; https://getbootstrap.com/docs/4.0/utilities/display/

回答by Mathieu Schaeffer

As Jaqen said, if you use Bootrstrap 3, you should use hidden-sminstead.

正如 Jaqen 所说,如果您使用 Bootrstrap 3,则应该hidden-sm改用。

Also, if you want to hide the image on small screen, you have to add hidden-xs.

另外,如果你想在小屏幕上隐藏图像,你必须添加hidden-xs.

Here's a JsFiddle : DEMO

这是一个 JsFiddle:演示

回答by Jaqen H'ghar

You mention you use Bootstrap 3

你提到你使用 Bootstrap 3

Use hidden-sminstead of hidden-sm-downwhich belongs to Bootstrap 4

使用hidden-sm而不是hidden-sm-down属于Bootstrap 4

On a side note:

旁注:

You also mention:

你还提到:

I want to hide those two images on small devices in order to have a different menu.

我想在小型设备上隐藏这两个图像以获得不同的菜单。

hidden-smwill hide the element on small screens such as iPad. To hide on extra small screens (such as Phones < 768px) add hidden-xs.

hidden-sm将在 iPad 等小屏幕上隐藏元素。要隐藏在超小屏幕(例如电话 < 768px)上,请添加hidden-xs.

Take a look at the Bootstrap sizes table here

此处查看 Bootstrap 大小表

回答by Yuvraj Patil

If you are using Bootstrap 4, you can utilize following:

如果您使用的是 Bootstrap 4,则可以使用以下内容:

Hidden only on small screens

仅隐藏在小屏幕上

<div class="d-none d-lg-block">hidden on screens smaller than lg</div>

Visible only on small screens

仅在小屏幕上可见

<div class="d-none d-sm-block">visible on small screens</div>