BOOTPLY HERE
I try to make some buttons text hidden to make them smaller for xs screen size.
<button class="btn navbar-btn btn-primary">
<i class="fa fa-font"></i>
<span class="hidden-xs">Add Text</span>
</button>
There is no problem with element hiding but now span
makes my button 2 rows. Is there any way to solve this problem.
Or is there any better approach to hide button texts in bootstrap?
For the ones who still has the same problem
If you are using bootstrap 3: http://getbootstrap.com/css/#responsive-utilities
<button class="btn navbar-btn btn-primary">
<i class="icon-picture"></i>
<span class="visible-sm-inline visible-md-inline visible-lg-inline">Add Image</span>
</button>
If you are using bootstrap 4: http://v4-alpha.getbootstrap.com/migration/#responsive-utilities
<button class="btn navbar-btn btn-primary">
<i class="icon-picture"></i>
<span class="hidden-xs-down">Add Image</span>
</button>
<h1 class="hidden-xs bg-danger">This text is hidden on an EXTRA SMALL screen.</ h1> <h1 class="hidden-sm bg-info">This text is hidden on a SMALL screen.</ h1> <h1 class="hidden-md bg-warning">This is text hidden on a MEDIUM screen.</
d-inline-block to simply set an element's display property to block , inline , or inline-block (respectively). To make an element display: none , use our responsive utilities instead. Inline. Inline. <div class="d-inline bg-success">Inline</div> <div class="d-inline bg-success">Inline</div>
One common use for display: inline-block is to display list items horizontally instead of vertically.
hidden-md-down hides an element on extra-small, small, and medium viewports. There are no explicit “visible”/”show” responsive utility classes; you make an element visible by simply not hiding it at that breakpoint size. You can combine one .
Since Bootstrap 3 uses..
.hidden-xs {
display: block !important;
}
You need to do this..
.navbar-btn .hidden-xs {
display: inline-block !important;
}
@media (max-width: 767px) {
.navbar-btn .hidden-xs {
display: none!important;
}
}
to override the block
display of the xs
span.
http://bootply.com/103026
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With