How do I make class visible-lg
not to move the span to a new line?
The following HTML renders as one line:
<p>Device is:<span>Unknown</span></p>
However, the following HTML renders Large
on the line below Device is
:
<p>Device is:<span class="visible-lg">Large</span></p>
This is now natively solved in Bootstrap v3.2.0 with this commit
According to the responsive classes documentation:
As of v3.2.0, the .visible-- classes for each breakpoint come in three variations, one for each CSS display property value listed below:
Group of classes | CSS display
.visible-*-block | display: block;
.visible-*-inline | display: inline;
.visible-*-inline-block | display: inline-block;
So in your case, you'd want to use:
<p>Device is:<span class="visible-lg-inline">Large</span></p>
In Bootstrap 3.0, all visible and hidden responsive classes use display:block !important;
You'll have to override that if you want to display elements inline:
@media (min-width: 1200px) {
span.visible-lg {
display: inline !important
}
}
For a more robust approach, here is a library that adds extension classes for each display type
Asked about on Stackoverflow:
Reported in Bootstrap Issues:
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