Bootstrap Responsive Container

Bootstrap responsive container covers 100% available width of the screen until the specified breakpoint, after which it takes max-widths for each of the higher breakpoins. For example, .container-md is 100% wide to start untill the md breakpoint is reached, where it will scale up with lg, xl, and xxl.

Bootstrap Responsive Container Classes:

Bootstrap containers have the following types of responsive container classes.

  • container-sm: It specifies 100% width till the sm breakpoint i.e. 540px and above 540px, it takes max-width.
  • container-md: It specifies 100% width till the md breakpoint i.e. 720px and above 720px, it takes max-width.
  • container-lg: It specifies 100% width till the lg breakpoint i.e. 960px and above 960px, it takes max-width.
  • container-xl: It specifies 100% width till the xl breakpoint i.e. 1140px and above 1140px, it takes max-width.
  • container-xxl: It specifies 100% width till the xxl breakpoint i.e. 1320px and above 1320px, it takes max-width.

General Syntax

<div class="container-{sm|md|lg|xl|xxl}">Responsive Container</div>        

Source Code

<div class="container-sm">
   <div class="alert alert-warning mt-4" role="alert">
      <p class="text-center">100% wide until small breakpoint</p>
   </div>
</div>

<div class="container-md">
   <div class="alert alert-success mt-4" role="alert">
      <p class="text-center">100% wide until medium breakpoint</p>
   </div>
</div>

<div class="container-lg">
   <div class="alert alert-info mt-4" role="alert">
      <p class="text-center">100% wide until large breakpoint</p>
   </div>
</div>

<div class="container-xl">
   <div class="alert alert-danger mt-4" role="alert">
      <p class="text-center">100% wide until extra large breakpoint</p>
   </div>
</div>

<div class="container-xxl">
   <div class="alert alert-success mt-4" role="alert">
      <p class="text-center">100% wide until extra extra large breakpoint</p>
   </div>
</div>        

If you want to learn more about Bootstrap responsive container, click here.

要查看或添加评论,请登录

Diwakar Chauhan的更多文章

  • Bootstrap Container Class

    Bootstrap Container Class

    In this tutorial, you will learn and understand the Bootstrap container class with the help of multiple examples…

  • Bootstrap Fixed Width Container

    Bootstrap Fixed Width Container

    Bootstrap containers are an essential element in the Bootstrap grid system. It plays an important role during grid…

  • Bootstrap Fluid Container

    Bootstrap Fluid Container

    Bootstrap fluid container/Bootstrap container fluid spans the entire width of the viewport or screen. It takes 100%…

  • Container in Bootstrap

    Container in Bootstrap

    The container in Bootstrap is used to set the padding around the content as well left and right margin to the content…

  • Bootstrap Containers

    Bootstrap Containers

    Bootstrap containers are the basic layout element in the Bootstrap grid system that is used to create empty space…

  • JSON Examples

    JSON Examples

    This section contains different JSON examples that belong to different JSON functions. Each function's feature has been…

  • HTML 5 Examples

    HTML 5 Examples

    This section consists of different HTML 5 examples that belong to different HTML 5 elements. Each element's feature has…

  • CSS 3 Examples

    CSS 3 Examples

    This section consists of different CSS 3 examples that belong to different CSS 3 components. Each component's feature…

  • Javascript Examples

    Javascript Examples

    This section consists of different Javascript examples that belong to different Javascript functions and features. JS…

  • jQuery Examples

    jQuery Examples

    This section contains different jQuery examples that belong to different jQuery functions. Each function's feature has…

社区洞察

其他会员也浏览了