Skip to content

Instantly share code, notes, and snippets.

@Garito
Created September 24, 2013 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garito/6681487 to your computer and use it in GitHub Desktop.
Save Garito/6681487 to your computer and use it in GitHub Desktop.
Bootstrap 3 mixins
Grid
With bootstrap 2 you do:
<div class="span2">
</div>
With boostrap 3 I do:
<div class="Logo">
</div>
then at a less file:
.Logo {
.make-xs-column(2); # This is the mixin used to small mobile screens
@media (min-width: @screen-sm) { # Medium mobile screens (alias tablets)
.make-sm-column(2);
}
@media (min-width: @screen-md) { # Small desktops
.make-md-column(2);
}
@media (min-width: @screen-lg) { # Large desktops
.make-lg-column(2);
}
}
bootstrap 2
<div class="container">
<div class="row"></div>
</div>
boostrap 3
<div class="Dashboard">
<div class="Digest"></div>
</div>
on Less
.Dashboard {
.container;
.Digest {
.make-row()
}
}
Icons
boostrap 2
<i class="icon-ok"></i>
boostrap 3
<span class="ok"> <span> # Note the space inside the tag
less
.ok {
.glyphicon;
.glyphicon-ok;
}
Tabs & Pills
boostrap 2
<ul class="nav nav-tabs"> # for pills will use nav nav-pills
<li class="active"><a href="#">tab 1</a></li>
<li><a href="#">tab 2</a></li>
</ul>
bootstrap 3
<ul class="Tabs">
<li><a href="#">tab 1</a></li>
<li><a href="#">tab 2</a></li>
</ul>
less
.Tabs {
.nav;
.nav-tabs;
li:first-child {
.active;
}
}
and so on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment