Responsive utility classes in Bootstrap Last Updated : 31 Jul, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report The responsive utility classes help to build responsive web designs easily. You can hide or display the content of your choice on the web page. You have to define the size of the screen for which you are hiding or displaying the content. Responsive utility classes are defined for five different types of sizes:xs: It denotes the extra small-sized screen, whose width will be less than 576px.sm: The small size screen with a width greater than or equal to 576px.md: It denotes a medium-sized screen with a width greater than or equal to 768px.lg: Large devices of width greater than or equal to 992px.xl: The Extra large devices with a width greater than or equal to 1200px.Here's the list of responsive utility classes:.d-none: This class is used to hide the content on all the different screen-sized devices..d-none .d-sm-block: This class is used to hide the content only on Extra small devices..d-sm-none .d-md-block: This class is used to hide the content only on small devices..d-md-none .d-lg-block: This class is used to hide the content only on medium-sized devices..d-lg-none .d-xl-block: This class is used to hide the content only on large devices..d-xl-none .d-xxl-block: This class is used to hide the content only on extra-large devices..d-block: This class is used to display the content on all the different screen-sized devices..d-block .d-sm-none: This class is used to display the content only on Extra small devices..d-none .d-sm-block .d-md-none: This class is used to display the content only on small devices..d-none .d-md-block .d-lg-none: This class is used to display the content only on medium-sized devices..d-none .d-lg-block .d-xl-none: This class is used to display the content only on large devices..d-none .d-xl-block .d-xxl-none: This class is used to display the content only on extra-large devices.// Visible only for small size devices<div class=".d-none .d-sm-block .d-md-none"> // Hidden only for medium size devices <div class=".d-md-none .d-lg-block"> <!---content of div tag---> </div></div>The examples below demonstrate the use of responsive utility classes:Example 1: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content= "width=device-width, initial-scale=1.0" /> <!-- Bootstrap cdn to link the bootstrap with HTML document --> <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity= "sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous" /> <style> .green { background-color: green; color: white; border: 2px solid black; } </style> <title>Responsive utility classes in Bootstrap</title> </head> <body> <div class="container"> <div class="row"> <span class="col d-md-block green"> Text 1 of first container </span> <span class="col d-md-none"> Text 2 of first container </span> <span class="col d-md-block green"> Text 3 of first container </span> </div> <div class="row"> <span class="col d-md-none"> Text 1 of second container </span> <span class="col d-md-block green"> Text 2 of second container </span> <span class="col d-md-none"> Text 3 of second container </span> </div> </div> <!-- Bootstrap jQuery link --> <script src= "https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity= "sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"> </script> <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity= "sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"> </script> </body> </html> Output:Example 2: HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content= "width=device-width, initial-scale=1.0" /> <!-- Bootstrap cdn to link the bootstrap with HTML document --> <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity= "sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous" /> <style> .green { background-color: green; color: white; border: 2px solid black; } </style> <title>Responsive utility classes in Bootstrap</title> </head> <body> <div class="container"> <div class="row"> <span class="col d-sm-none green"> Text 1 of first container </span> <span class="col d-sm-block"> Text 2 of first container </span> <span class="col d-sm-none green"> Text 3 of first container </span> </div> <div class="row"> <span class="col d-sm-block"> Text 1 of second container </span> <span class="col d-sm-none green"> Text 2 of second container </span> <span class="col d-sm-block"> Text 3 of second container </span> </div> </div> <!-- Bootstrap jQuery link --> <script src= "https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity= "sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"> </script> <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity= "sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"> </script> </body> </html> Output: Comment More infoAdvertise with us Next Article Responsive utility classes in Bootstrap A abhisheksainiaggarwal Follow Improve Article Tags : Web Technologies Bootstrap Geeks Premier League Geeks-Premier-League-2022 Bootstrap-Questions Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read Web Development Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De 5 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version 7 min read JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q 15+ min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read 3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power 13 min read Like