Bootstrap Col-XS: Mastering Bootstrap Extra Small Grid - BitDegree

By now, you are familiar with using a grid system and utility classes. Therefore, our next tutorial should seem easy: we will introduce responsive classes that you can use in your grids.

Bootstrap Col-XS classes are applied in the cases of devices with tiny screens - no more than 576 pixels in width. In most cases, it is a rather simple phone.

Contents

  • 1. Bootstrap Col-XS: Main Tips
  • 2. XS Grid
  • 3. Auto Layout
  • 4. Bootstrap Col-XS: Summary

Bootstrap Col-XS: Main Tips

  • Bootstrap 4 grid system offers a set of responsive classes to specify on what screens a certain layout works.
  • The Bootstrap Col-XS (extra small) class applies a grid column class to an element when the screen is narrower than 576px.
  • It is created by using Bootstrap col-xs-* in your code.

XS Grid

The Bootstrap extra small (col-xs) column classes apply when the screen is narrower than 576px.

Columns like the ones you see below are created by using the class prefix .col-xs-*:

col-xs-4 col-xs-8

Now, here we have an HTML example that creates a simple layout which applies to any screen size and looks like the one displayed above:

Example Copy <div class="container"> <div class="row"> <div class="bg-info col-xs-4"> ... </div> <div class="bg-primary col-xs-8"> ... </div> </div> </div> Try it Live Learn on Udacity

DataCamp Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
GET 50% OFF Udacity Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
UP TO 70% OFF edX Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion
FREE COURSES

Auto Layout

Using Bootstrap 4 grid system, you can also create auto layouts. They are made by not specifying how many columns a grid column should span (skipping the number for all column containers inside a row container).

When you do this, Bootstrap 4 automatically determines how many columns each column element should span through for all of them to be equal and span through the whole available width together:

Example Copy <div class="row"> <!-- Five 20% wide columns --> <div class="bg-primary col">1</div> <div class="bg-secondary col">2</div> <div class="bg-primary col">3</div> <div class="bg-secondary col">4</div> <div class="bg-primary col">5</div> </div> Try it Live Learn on Udacity

Bootstrap Col-XS: Summary

  • The responsive classes are used in the grid system to specify the size of the screen that a certain layout works on.
  • Bootstrap extra small, or Col-XS class applies a grid column class to an element when the user is not using a screen that is wider than 576px.

Từ khóa » Html Css Col-xs