Friday, July 25, 2014

Bootstrap Responsive Utilities

For more rapidly mobile-friendly development Bootstrap offers a number of handful helper classes. These classes can be used for hiding and showing content on by device using media query combined with small, medium and large devices. Use these classes carefully and avoid creating completely different versions of the similar site. Bootstrap responsive utilities are presently simply available for block and table toggling.








































ClassesDevices
.visible-xsExtra small (less than 768px) visible
.visible-smSmall (up to 768 px) visible
.visible-mdMedium (768 px to 991 px) visible
.visible-lgLarger (992 px and above) visible
.hidden-xsExtra small (less than 768px) hidden
.hidden-smSmall (up to 768 px) hidden
.hidden-mdMedium (768 px to 991 px) hidden
.hidden-lgLarger (992 px and above) hidden

Print classes


Below table is listing the print classes. For print the content use these for toggling.















ClassesPrint
.visible-printYes Visible for Printing
.hidden-printOnly Visible to browser not for print.

Example


Below mentioned example demonstrates the make use of top listed helper classes. Resize your browser window or run these examples on different resolutions or devices to check the responsive utility classes.


<div class="container" style="padding: 40px;">
<div class="row visible-on">
<div class="col-xs-6 col-sm-3" style="background-color: #dedef8;
box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
<span class="hidden-xs">Extra small</span>
<span class="visible-xs">✔ Visible on x-small</span>
</div>
<div class="col-xs-6 col-sm-3" style="background-color: #dedef8;
box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
<span class="hidden-sm">Small</span>
<span class="visible-sm">✔ Visible on small</span>
</div>
<div class="clearfix visible-xs"></div>
<div class="col-xs-6 col-sm-3" style="background-color: #dedef8;
box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
<span class="hidden-md">Medium</span>
<span class="visible-md">✔ Visible on medium</span>
</div>
<div class="col-xs-6 col-sm-3" style="background-color: #dedef8;
box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;">
<span class="hidden-lg">Large</span>
<span class="visible-lg">✔ Visible on large</span>
</div>
</div>


Checkmarks indicate the element is visible in your current viewport.



Bootstrap Responsive Utilities

No comments:

Post a Comment