From b76d98eee3fa4a1a8d7fb281a31a7d20982459d3 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 23 Jun 2013 15:05:50 -0700 Subject: Fixes #8211: restore proper table grid class behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Needs work though—we shouldn't be setting this stuff with the attribute selectors, but it's the easiest solution for now. --- less/tables.less | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'less/tables.less') diff --git a/less/tables.less b/less/tables.less index fa5fd554b..88481a944 100644 --- a/less/tables.less +++ b/less/tables.less @@ -184,16 +184,18 @@ th { // ----------------- // Reset default table behavior -table col[class*="col-span-"] { +table col[class^="col-"] { float: none; display: table-column; } -table td[class*="col-span-"], -table th[class*="col-span-"] { +table td[class^="col-"], +table th[class^="col-"] { float: none; display: table-cell; } + + // TABLE BACKGROUNDS // ----------------- // Exact selectors below required to override .table-striped -- cgit v1.2.3 From e5e9d5916ab6e14aff18e5fb2f9e8e1f2eccb5a1 Mon Sep 17 00:00:00 2001 From: liuyl Date: Mon, 1 Jul 2013 20:29:41 +0800 Subject: simplify tables.less --- less/tables.less | 74 +++++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 39 deletions(-) (limited to 'less/tables.less') diff --git a/less/tables.less b/less/tables.less index 88481a944..392593902 100644 --- a/less/tables.less +++ b/less/tables.less @@ -95,33 +95,31 @@ th { > tbody:first-child > tr:first-child td { border-top: 0; } - // For first th/td in the first row in the first thead or tbody - > thead:first-child > tr:first-child > th:first-child, - > tbody:first-child > tr:first-child > td:first-child, - > tbody:first-child > tr:first-child > th:first-child { - border-top-left-radius: @border-radius-base; - } - // For last th/td in the first row in the first thead or tbody - > thead:first-child > tr:first-child > th:last-child, - > tbody:first-child > tr:first-child > td:last-child, - > tbody:first-child > tr:first-child > th:last-child { - border-top-right-radius: @border-radius-base; - } - // For first th/td (can be either) in the last row in the last thead, tbody, and tfoot - > thead:last-child > tr:last-child > th:first-child, - > tbody:last-child > tr:last-child > td:first-child, - > tbody:last-child > tr:last-child > th:first-child, - > tfoot:last-child > tr:last-child > td:first-child, - > tfoot:last-child > tr:last-child > th:first-child { - border-bottom-left-radius: @border-radius-base; - } - // For last th/td (can be either) in the last row in the last thead, tbody, and tfoot - > thead:last-child > tr:last-child > th:last-child, - > tbody:last-child > tr:last-child > td:last-child, - > tbody:last-child > tr:last-child > th:last-child, - > tfoot:last-child > tr:last-child > td:last-child, - > tfoot:last-child > tr:last-child > th:last-child { - border-bottom-right-radius: @border-radius-base; + > thead:first-child > tr:first-child > th, + > tbody:first-child > tr:first-child > td, + > tbody:first-child > tr:first-child > th { + // For first th/td in the first row in the first thead or tbody + &:first-child{ + border-top-left-radius: @border-radius-base; + } + // For last th/td in the first row in the first thead or tbody + &:last-child{ + border-top-right-radius: @border-radius-base; + } + } + > thead:last-child > tr:last-child > th, + > tbody:last-child > tr:last-child > td, + > tbody:last-child > tr:last-child > th, + > tfoot:last-child > tr:last-child > td, + > tfoot:last-child > tr:last-child > th { + // For first th/td (can be either) in the last row in the last thead, tbody, and tfoot + &:first-child{ + border-bottom-left-radius: @border-radius-base; + } + // For last th/td (can be either) in the last row in the last thead, tbody, and tfoot + &:last-child{ + border-bottom-right-radius: @border-radius-base; + } } // Clear border-radius for first and last td in the last row in the last tbody for table with tfoot @@ -133,19 +131,17 @@ th { } // Special fixes to round the left border on the first td/th - > caption + thead > tr:first-child > th:first-child, - > caption + tbody > tr:first-child > td:first-child, - > colgroup + thead > tr:first-child > th:first-child, - > colgroup + tbody > tr:first-child > td:first-child { - border-top-left-radius: @border-radius-base; - } - > caption + thead > tr:first-child > th:last-child, - > caption + tbody > tr:first-child > td:last-child, - > colgroup + thead > tr:first-child > th:last-child, - > colgroup + tbody > tr:first-child > td:last-child { - border-top-right-radius: @border-radius-base; + > caption + thead > tr:first-child > th, + > caption + tbody > tr:first-child > td, + > colgroup + thead > tr:first-child > th, + > colgroup + tbody > tr:first-child > td { + &:first-child{ + border-top-left-radius: @border-radius-base; + } + &:last-child{ + border-top-right-radius: @border-radius-base; + } } - } -- cgit v1.2.3 From da072fff21f565521d3dbe1f5f4f42550ecc989e Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 2 Jul 2013 11:25:57 -0700 Subject: refactor tables.less to use nesting more --- less/tables.less | 106 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 62 insertions(+), 44 deletions(-) (limited to 'less/tables.less') diff --git a/less/tables.less b/less/tables.less index 392593902..ebfb1c656 100644 --- a/less/tables.less +++ b/less/tables.less @@ -19,27 +19,31 @@ th { width: 100%; margin-bottom: @line-height-computed; // Cells - thead > tr > th, - tbody > tr > th, - thead > tr > td, - tbody > tr > td { - padding: 8px; - line-height: @line-height-base; - vertical-align: top; - border-top: 1px solid @table-border-color; + thead, + tbody { + > tr { + > th, + > td { + padding: 8px; + line-height: @line-height-base; + vertical-align: top; + border-top: 1px solid @table-border-color; + } + } } // Bottom align for column headings thead > tr > th { vertical-align: bottom; } // Remove top border from thead by default - caption + thead tr:first-child th, - caption + thead tr:first-child td, - colgroup + thead tr:first-child th, - colgroup + thead tr:first-child td, - thead:first-child tr:first-child th, - thead:first-child tr:first-child td { - border-top: 0; + caption + thead, + colgroup + thead, + thead:first-child { + tr:first-child { + th, td { + border-top: 0; + } + } } // Account for multiple tbody instances tbody + tbody { @@ -58,11 +62,14 @@ th { // ------------------------------- .table-condensed { - thead > tr > th, - tbody > tr > th, - thead > tr > td, - tbody > tr > td { - padding: 4px 5px; + thead, + tbody { + > tr { + > th, + > td { + padding: 4px 5px; + } + } } } @@ -77,11 +84,14 @@ th { border-left: 0; border-radius: @border-radius-base; - > thead > tr > th, - > tbody > tr > th, - > thead > tr > td, - > tbody > tr > td { - border-left: 1px solid @table-border-color; + > thead, + > tbody { + > tr { + > th, + > td { + border-left: 1px solid @table-border-color; + } + } } // Prevent a double border > caption + thead > tr:first-child th, @@ -131,15 +141,16 @@ th { } // Special fixes to round the left border on the first td/th - > caption + thead > tr:first-child > th, - > caption + tbody > tr:first-child > td, - > colgroup + thead > tr:first-child > th, - > colgroup + tbody > tr:first-child > td { - &:first-child{ - border-top-left-radius: @border-radius-base; - } - &:last-child{ - border-top-right-radius: @border-radius-base; + > caption, + > colgroup { + + thead > tr:first-child > th, + + tbody > tr:first-child > td { + &:first-child { + border-top-left-radius: @border-radius-base; + } + &:last-child { + border-top-right-radius: @border-radius-base; + } } } } @@ -152,9 +163,11 @@ th { // Default zebra-stripe styles (alternating gray and transparent backgrounds) .table-striped { > tbody { - > tr:nth-child(odd) > td, - > tr:nth-child(odd) > th { - background-color: @table-bg-accent; + > tr:nth-child(odd) { + > td, + > th { + background-color: @table-bg-accent; + } } } } @@ -167,9 +180,11 @@ th { // Placed here since it has to come after the potential zebra striping .table-hover { > tbody { - > tr:hover > td, - > tr:hover > th { - background-color: @table-bg-hover; + > tr:hover { + > td, + > th { + background-color: @table-bg-hover; + } } } } @@ -184,10 +199,13 @@ table col[class^="col-"] { float: none; display: table-column; } -table td[class^="col-"], -table th[class^="col-"] { - float: none; - display: table-cell; +table { + td, th { + &[class^="col-"] { + float: none; + display: table-cell; + } + } } -- cgit v1.2.3 From 88a266b800a74b8445d06ac2fcb70ab97f035dfd Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 5 Jul 2013 14:15:00 -0500 Subject: Add tfoot back (addresses more than #8387) --- less/tables.less | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'less/tables.less') diff --git a/less/tables.less b/less/tables.less index ebfb1c656..9d39ad39f 100644 --- a/less/tables.less +++ b/less/tables.less @@ -20,7 +20,8 @@ th { margin-bottom: @line-height-computed; // Cells thead, - tbody { + tbody, + tfoot { > tr { > th, > td { @@ -63,7 +64,8 @@ th { .table-condensed { thead, - tbody { + tbody, + tfoot { > tr { > th, > td { @@ -85,7 +87,8 @@ th { border-radius: @border-radius-base; > thead, - > tbody { + > tbody, + > tfoot { > tr { > th, > td { @@ -200,7 +203,8 @@ table col[class^="col-"] { display: table-column; } table { - td, th { + td, + th { &[class^="col-"] { float: none; display: table-cell; -- cgit v1.2.3