Layouts

Layouts help you to define a standard structure or the skeleton for your websites. There are three types of layouts:

  • Fixed layouts
  • Fluid layouts
  • Responsive layouts

Fixed layouts do not change with screen size and all styles are static. Fluid layouts make the div elements flow to the bottom if they cannot be accommodated across the width of the viewing screen. Responsive layouts keep a very close eye on and respond to the adjusting screen sizes. These options can be used as described in the following sections.

Fixed layouts

A fixed layout of a website has a wrapper (which wraps or contains all columns) of a constant width, that is, which cannot be changed no matter how small or how big the screen resolution is. The wrapper or the container cannot be moved and is set to a fixed position. The reason why many web designers prefer fixed layouts is due to ease in usage and customization.

Description

In fixed layout, column widths are fixed and cannot be changed. The syntax for declaring fixed layouts for your website is as follows:

<body>
  <div class="container"> <!--This line is for declaring fixed layouts-->
  </div>
</body>

Everything inside the container class in the preceding code will be fixed for every device in which this code is executed.

Fluid layouts

A fluid layout acts just like a liquid and adjusts itself according to the screen resolution of the user at runtime. The components of such layouts mainly contain percentage widths and thus adjust to the user's screen effectively. Such layouts are more user friendly and make the website look better. It also improves accessibility and interface.

Description

Fluid layouts adjust themselves according to the screen resolution they receive using predefined percentage widths. The syntax for declaring fluid layouts for your website is shown here:

<div class="container-fluid"> <!--declaration of a fluid container-->
  <div class="row-fluid">
    <div class="span3"> <!--spans 3 columns -->
      <!--Sidebar content-->
    </div>
    <div class="span5"> <!--spans 5 columns -->
      <!--Body content-->
    </div>
  </div>
</div>

Bootstrap's grid system allows up to 12 columns across the page.

In the preceding example, span3 combines three columns and span5 combines five columns, and together they complete the whole page adjusting the layout according to the screen resolution.

Responsive layouts

Responsive layouts provide a design for a website depending on the number of conditions, which include ratios, widths, display types, and so on. Such layouts automatically adjust and adapt to any screen size, thus providing better accessibility and optimal viewing experience to the user.

Description

Responsive layouts are a growing trend among web designers as they offer less hassles in customization and implementation.

The following example code shows how you can include responsive features using meta tags along with a Bootstrap stylesheet:

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">

Supported devices

To provide effective layouts on a number of different devices, Bootstrap can support many media queries in one file. The following table shows the range of devices that are supported:

Label

Layout width

Column width

Gutter width

Large display

1200px and up

70px

30px

Default

980px and up

60px

20px

Portrait tablets

768px and up

42px

20px

Phones to tablets

767px and lower

Fluid columns, no fixed width available

Phones

480px and lower

Fluid columns, no fixed width available

Referenced from: http://getbootstrap.com/css/#grid-options

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.37.12