Dieses Blog durchsuchen

Dienstag, 2. August 2016

Mobile first gridlayouts with twitter boostrap 3

Today we want to play a little with mobile first grid layouts.

Noone wants to create a website in more than 1 version for different devices. Since twitter 3 moves its default "fixed width" behaviour to "mobile first", all new layouts are using the fluid grid version. So you can use your layout on different devices like mobile, tablet, desktop and even cellphones.

So lets start:

At first we have to include the bootstrap (3.7.x) library.  I m using cdn, to make it simple. In reality you want to require or import it, or use grunt or gulp as a dependency manager.

This is my html file "2_column_grid.html". I am using vs code to generate it.



This simple grid renders 2 Boxes with the 6 columns (col-sm-6). That means, that each box takes the half of the windowwitdh. 100 % are 12 columns. So 12 / 6 = 2. If you want to have 4 boxes you have user 3 columns. (col-sm3) and so on.



Okay.Now we want to create a 4 column layout for medium screens with a resolution > 990 pixels (Laptops / Desktops)


Now we want to create a 3 column layout, that will turn to a 2 column layout if the screen gets smaller.

Keine Kommentare:

Kommentar veröffentlichen