简体   繁体   English

在小屏幕上删除bootstrap .btn-group

[英]remove bootstrap .btn-group on small screen

I am using below HTML tags to generate list of buttons and using .btn-group to group the buttons together. 我使用下面的HTML标记生成按钮列表,并使用.btn-group group将按钮分组在一起。

<div class="btn-group mt-30">
    <a class="btn btn-border-d btn-circle" href="#">
        exmaple 1
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 2
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 3
    </a>
</div>

which generates the view like 生成像 在此处输入图片说明

But on viewing the page on small device like mobile, the view is rendered as 但是在小型设备(例如移动设备)上查看页面时,视图呈现为 在此处输入图片说明

On small devices, I want to remove .btn-group class because on small devices, I want to render each button in a new line like 在小型设备上,我想删除.btn-group类,因为在小型设备上,我想在新行中渲染每个按钮,例如

在此处输入图片说明

Removing .btn-group from div renders view as shown in 3rd image. div删除.btn-group会渲染视图,如图3所示。

How can I apply .btn-group on large devices only, ie, with md or lg and diable it on sm , xs ? 如何仅将.btn-group应用于大型设备,即使用mdlg并在smxs上对其进行.btn-group

You should overwrite .btn-group .btn on small devices: 您应该在小型设备上覆盖.btn-group .btn

@media (max-width: 760px) {
    .btn-group .btn.btn-circle {
        border-radius: 10px;
        display: block;
        float: none;
    }
}

@Justinas' answer is probably better for this case, but if you wanted to actually have different markup for the different sized displays, you could use Bootstrap's Responsive Utilities . 在这种情况下,@ Justinas的答案可能会更好,但是如果您想为不同尺寸的显示器实际使用不同的标记,则可以使用Bootstrap的Responsive Utilities

<div class="btn-group mt-30 hidden-sm hidden-xs">
    <a class="btn btn-border-d btn-circle" href="#">
        exmaple 1
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 2
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 3
    </a>
</div>

And on small devices: 在小型设备上:

<div class="visible-sm-block visible-xs-block">
    <a class="btn btn-border-d btn-circle" href="#">
        exmaple 1
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 2
    </a>
    <a class="btn btn-border-d btn-circle" href="#">
        example 3
    </a>
</div>

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

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