Skip to content

Instantly share code, notes, and snippets.

@rurtubia
Last active August 29, 2015 14:22
Show Gist options
  • Save rurtubia/049000101deb2a057a44 to your computer and use it in GitHub Desktop.
Save rurtubia/049000101deb2a057a44 to your computer and use it in GitHub Desktop.
Tables in Bootstrap

##Tables in Bootstrap

Bootstrap uses a responsive 12-column grid system, which makes it easy to put elements into rows and specify each element's relative width. Most of Bootstrap's classes can be applied to a div element.

Here's a diagram of how Bootstrap's 12-column grid layout works:

Note that in this illustration, we use the col-md-* class. Here, md means "medium", and * is a number specifying how many columns wide the element should be. In this case, we're specifying how many columns wide an element should be on a medium-sized screen, such as a laptop.

In the Cat Photo App that we're building, we'll use col-xs-*, where * is the number of columns wide the element should be, and xs means "extra small", like an extra-small mobile phone screen.

The row class is applied to a div, and the buttons themselves can be wrapped within it.

<link
rel='stylesheet'
href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'
/>
<div class='row'>
<div class='col-xs-8'>
<h2 class='text-primary text-center'>CatPhotoApp</h2>
</div>
<div class='col-xs-4'>
<img class='img-responsive thick-green-border' src='https://bit.ly/fcc-kittens'/>
</a>
</div>
</div>
<link
rel='stylesheet'
href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'
/>
<div class='row'>
<div class='col-xs-4'>
<button class='btn btn-block btn-primary'>Like</button>
</div>
<div class='col-xs-4'>
<button class='btn btn-block btn-info'>Info</button>
</div>
<div class='col-xs-4'>
<button class='btn btn-block btn-danger'>Delete</button>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment