.visible-*-* classes, show on different screen size - HTML CSS Bootstrap

HTML CSS examples for Bootstrap:Grid Layout

Introduction

Class Description
.visible-xs-* Makes the element visible only on extra small devices having screen width less than 768px. Hidden on others.
.visible-sm-* Makes the element visible only on small devices having screen width greater than or equal to 768px but less than 992px. Hidden on others.
.visible-md-* Makes the element visible only on medium devices having screen width greater than or equal to 992px but less than 1200px. Hidden on others.
.visible-lg-* Makes the element visible only on large devices having screen width greater than or equal to 1200px. Hidden on others.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Example of Bootstrap 3 Visible Responsive Classes</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  <style type="text/css">
    p{<!--   w w w . j  a v a 2  s .c  o m-->
        padding: 20px;
        background: #FFF0F5;
        border-radius: 5px;
    }

</style>
 </head>
 <body>
  <div>
   <p class="visible-xs">This paragraph is visible only on <strong>Extra Small Devices</strong> that has screen width less than <code>768px</code>.</p>
   <p class="visible-sm">This paragraph is visible only on <strong>Small Devices</strong> that has screen width greater than equal to <code>768px</code> but less than <code>992px</code>.</p>
   <p class="visible-md">This paragraph is visible only on <strong>Medium Devices</strong> that has screen width greater than or equal to <code>992px</code> but less than <code>1200px</code>.</p>
   <p class="visible-lg">This paragraph is visible only on <strong>Large Devices</strong> that has screen width greater than or equal to <code>1200px</code>.</p>
  </div>
 </body>
</html>

Related Tutorials