Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 - how to hide input-group-btn on a specific device

I wish to hide an input-group-btn when viewed on extra-small devices. What is the appropriate way to achieve this?

I've tried the following:

    <div class="input-group">
        <input type="text" class="form-control">
        <div class="input-group-btn hidden-xs">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
            <ul class="dropdown-menu pull-right">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li><a href="#">Separated link</a></li>
            </ul>
        </div><!-- /btn-group --> 
    </div><!-- /input-group --> 

But it messes up the rendering of the input-group http://bootply.com/81206

Without 'hidden-xs':

enter image description here

With 'hidden-xs':

enter image description here

like image 587
gpcola Avatar asked Nov 02 '22 14:11

gpcola


1 Answers

@Focus is right, this isn't possible using [responsive utility classes][3], but I managed to work around it http://bootply.com/81230

CSS

@media (max-width: 768px) {
    .hidebtn-xs, .hidebtn-xs input {
        display: block !important;
    }
    .hidebtn-xs .input-group-btn {
        display: none !important;
    }
}

HTML

    <div class="input-group hidebtn-xs">
        <input type="text" class="form-control">
        <div class="input-group-btn">
            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Action <span class="caret"></span></button>
            <ul class="dropdown-menu pull-right">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li class="divider"></li>
                <li><a href="#">Separated link</a></li>
            </ul>
        </div><!-- /btn-group --> 
    </div><!-- /input-group --> 
like image 125
gpcola Avatar answered Nov 07 '22 20:11

gpcola