- Details
- Written by Super User Super User
- Parent Category: Documentation Documentation
- Category: Documentation and Setup Documentation and Setup
- Published: 09 September 2013 09 September 2013
- Last Updated: 12 September 2013 12 September 2013
- Created: 09 September 2013 09 September 2013
- Hits: 6663 6663
Fluid grid system
-
Live fluid grid example
The fluid grid system uses percents instead of pixels for column widths. It has the same responsive capabilities as our fixed grid system, ensuring proper proportions for key screen resolutions and devices.
111111111111444486612Basic fluid grid HTML
Make any row "fluid" by changing
.row
to.row-fluid
. The column classes stay the exact same, making it easy to flip between fixed and fluid grids.<div class="row-fluid"> <div class="span4">...</div> <div class="span8">...</div> </div>
Fluid offsetting
Operates the same way as the fixed grid system offsetting: add
.offset*
to any column to offset by that many columns.44 offset 43 offset 33 offset 36 offset 6<div class="row-fluid"> <div class="span4">...</div> <div class="span4 offset2">...</div> </div>
Fluid nesting
Fluid grids utilize nesting differently: each nested level of columns should add up to 12 columns. This is because the fluid grid uses percentages, not pixels, for setting widths.
Fluid 12Fluid 6Fluid 6Fluid 6Fluid 6<div class="row-fluid"> <div class="span12"> Fluid 12 <div class="row-fluid"> <div class="span6"> Fluid 6 <div class="row-fluid"> <div class="span6">Fluid 6</div> <div class="span6">Fluid 6</div> </div> </div> <div class="span6">Fluid 6</div> </div> </div> </div>
Responsive features
-
About responsive Wright
Media queries allow for custom CSS based on a number of conditions—ratios, widths, display type, etc—but usually focuses around
min-width
andmax-width
.- Modify the width of column in our grid
- Stack elements instead of float wherever necessary
- Resize headings and text to be more appropriate for devices
Use media queries responsibly and only as a start to your mobile audiences. For larger projects, do consider dedicated code bases and not layers of media queries.
Supported devices
Bootstrap supports a handful of media queries in a single file to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:
Label Layout width Column width Gutter width Large display 1200px and up 70px 30px Default 980px and up 60px 20px Portrait tablets 768px and above 42px 20px Phones to tablets 767px and below Fluid columns, no fixed widths Phones 480px and below Fluid columns, no fixed widths /* Large desktop */ @media (min-width: 1200px) { ... } /* Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { ... } /* Landscape phone to portrait tablet */ @media (max-width: 767px) { ... } /* Landscape phones and down */ @media (max-width: 480px) { ... }
Responsive utility classes
For faster mobile-friendly development, use these utility classes for showing and hiding content by device. Below is a table of the available classes and their effect on a given media query layout (labeled by device). They can be found in
responsive.less
.Class Phones 767px and below Tablets 979px to 768px Desktops Default .visible-phone
Visible Hidden Hidden .visible-tablet
Hidden Visible Hidden .visible-desktop
Hidden Hidden Visible .hidden-phone
Hidden Visible Visible .hidden-tablet
Visible Hidden Visible .hidden-desktop
Visible Visible Hidden When to use
Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation. Responsive utilities should not be used with tables, and as such are not supported.
Responsive utilities test case
Resize your browser or load on different devices to test the above classes.
Visible on...
Green checkmarks indicate that class is visible in your current viewport.
- Phone✔ Phone
- Tablet✔ Tablet
- Desktop✔ Desktop
Hidden on...
Here, green checkmarks indicate that class is hidden in your current viewport.