diff --git a/axis/layout.styl b/axis/layout.styl index 0eadb9e..9fc012f 100644 --- a/axis/layout.styl +++ b/axis/layout.styl @@ -112,3 +112,22 @@ ratio-box(ratio = 1/1) display: block height: 0 padding-top: (1 / ratio) * 100% + + +// Mixin: Table Layout +// +// Sometimes you just need a good old-fashioned table layout. +// Read more: http://colintoh.com/blog/display-table-anti-hero +// +// ex: tl() +// ex: tl(auto) + +tl(layoutType = fixed) + display: table + table-layout: layoutType // "fixed" or "auto" + margin: 0 + padding: 0 + width: 100% + + > * + display: table-cell diff --git a/test/fixtures/layout/table-layout.css b/test/fixtures/layout/table-layout.css new file mode 100644 index 0000000..52ab210 --- /dev/null +++ b/test/fixtures/layout/table-layout.css @@ -0,0 +1,10 @@ +.tl { + display: table; + table-layout: fixed; + margin: 0; + padding: 0; + width: 100%; +} +.tl > * { + display: table-cell; +} diff --git a/test/fixtures/layout/table-layout.styl b/test/fixtures/layout/table-layout.styl new file mode 100644 index 0000000..56a0794 --- /dev/null +++ b/test/fixtures/layout/table-layout.styl @@ -0,0 +1,2 @@ +.tl + tl() diff --git a/test/test.coffee b/test/test.coffee index 566b496..53a17f1 100644 --- a/test/test.coffee +++ b/test/test.coffee @@ -167,6 +167,9 @@ describe 'layout', -> it 'vertical-align', (done) -> compile_and_match(path.join(@path, 'vertical-align.styl'), done) + it 'table-layout', (done) -> + compile_and_match(path.join(@path, 'table-layout.styl'), done) + describe 'print', -> before -> @path = path.join(test_path, 'print') diff --git a/test/visual.html b/test/visual.html index 043bda5..5237818 100644 --- a/test/visual.html +++ b/test/visual.html @@ -49,6 +49,7 @@ + @@ -256,6 +257,14 @@