From b82f85ed75b0fe215afaea5ed941e958adf789ca Mon Sep 17 00:00:00 2001 From: Kyle Sollenberger Date: Thu, 9 Jun 2011 11:12:24 -0700 Subject: [PATCH] Added flexible box module mixin. Example provided in Index.html --- bootstrap.less | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 25 +++++++++++++++++++++++- style.less | 14 ++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/bootstrap.less b/bootstrap.less index 722244f..402bed5 100644 --- a/bootstrap.less +++ b/bootstrap.less @@ -237,4 +237,56 @@ -khtml-opacity: @op / 100; -moz-opacity: @op / 100; opacity: @op / 100; +} + +// CSS3 Flexible Box Module +#flexbox { + // #flexbox > .display-box; must be used along with other flexbox mixins + .display-box { + display: -moz-box; + display: -webkit-box; + display: box; + } + // Box align [ start | end | center | baseline | stretch ] + .box-align(@alignment: stretch) { + -moz-box-align: @alignment; + -webkit-box-align: @alignment; + box-align: @alignment; + } + // Box direction [ normal | reverse | inherit ] + .box-direction(@direction: normal) { + -moz-box-direction: @direction; + -webkit-box-direction: @direction; + box-direction: @direction; + } + // Box flex [ integer ] + .box-flex(@flex: 0) { + -moz-box-flex: @flex; + -webkit-box-flex: @flex; + box-flex: @flex; + } + // Box flex group [ integer ] + .box-flex-group(@group: 1) { + -moz-box-flex-group: @group; + -webkit-box-flex-group: @group; + box-flex-group: @group; + } + // Box orientation [ horizontal | vertical | inline-axis | block-axis | inherit ] + .box-orient(@orientation: horizontal) { + -moz-box-orient: @orientation; + -webkit-box-orient: @orientation; + box-orient: @orientation; + } + // Box ordinal group [ integer ] + .box-ordinal-group(@group: 1) { + -moz-box-ordinal-group: @group; + -webkit-box-ordinal-group:@group; + box-flex-ordinal-group: @group; + } + // Box pack [ start | end | center | justify ] + .box-pack(@pack: start) { + -moz-box-pack: @pack; + -webkit-box-pack: @pack; + box-pack: @pack; + } } \ No newline at end of file diff --git a/index.html b/index.html index bbb708f..b2db9df 100644 --- a/index.html +++ b/index.html @@ -49,6 +49,7 @@

Mixins

  • Buttons
  • Grid System
  • Helpers
  • +
  • Flexible Box Module
  • @@ -239,7 +240,29 @@

    Miscellaneous helpers

    } - +
    +

    Flexible Box Module

    +

    +
    +
    +
    +
    +
    +
    +div.flexbox {
    +  #flexbox > .display-box;
    +  #flexbox > .box-pack(center);
    +  div {
    +    margin: 5px;
    +    #translucent > .background(@black,.25);
    +    .square(50px);
    +  }
    +  div.box2 {
    +    #flexbox > .box-flex(1);
    +  }
    +}
    +
    +

    Variables

    Variables have never existed in CSS, but with LESS, they're all up in da club. Bootstrap includes a set of great colors perfect for just about any project as an example of how to use variables.

    diff --git a/style.less b/style.less index 86afa1a..165b9aa 100644 --- a/style.less +++ b/style.less @@ -164,3 +164,17 @@ div.grid { } } } + +// Flexbox example +div.flexbox { + #flexbox > .display-box; + #flexbox > .box-pack(center); + div { + margin: 5px; + #translucent > .background(@black,.25); + .square(50px); + } + div.box2 { + #flexbox > .box-flex(1); + } +} \ No newline at end of file