Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
da072fff
Commit
da072fff
authored
11 years ago
by
Chris Rebert
Browse files
Options
Download
Email Patches
Plain Diff
refactor tables.less to use nesting more
parent
749dc353
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/assets/css/bootstrap.css
+4
-4
docs/assets/css/bootstrap.css
less/tables.less
+62
-44
less/tables.less
with
66 additions
and
48 deletions
+66
-48
docs/assets/css/bootstrap.css
+
4
-
4
View file @
da072fff
...
@@ -1126,10 +1126,10 @@ th {
...
@@ -1126,10 +1126,10 @@ th {
}
}
.table
caption
+
thead
tr
:first-child
th
,
.table
caption
+
thead
tr
:first-child
th
,
.table
caption
+
thead
tr
:first-child
td
,
.table
colgroup
+
thead
tr
:first-child
th
,
.table
colgroup
+
thead
tr
:first-child
th
,
.table
colgroup
+
thead
tr
:first-child
td
,
.table
thead
:first-child
tr
:first-child
th
,
.table
thead
:first-child
tr
:first-child
th
,
.table
caption
+
thead
tr
:first-child
td
,
.table
colgroup
+
thead
tr
:first-child
td
,
.table
thead
:first-child
tr
:first-child
td
{
.table
thead
:first-child
tr
:first-child
td
{
border-top
:
0
;
border-top
:
0
;
}
}
...
@@ -1212,15 +1212,15 @@ th {
...
@@ -1212,15 +1212,15 @@ th {
}
}
.table-bordered
>
caption
+
thead
>
tr
:first-child
>
th
:first-child
,
.table-bordered
>
caption
+
thead
>
tr
:first-child
>
th
:first-child
,
.table-bordered
>
caption
+
tbody
>
tr
:first-child
>
td
:first-child
,
.table-bordered
>
colgroup
+
thead
>
tr
:first-child
>
th
:first-child
,
.table-bordered
>
colgroup
+
thead
>
tr
:first-child
>
th
:first-child
,
.table-bordered
>
caption
+
tbody
>
tr
:first-child
>
td
:first-child
,
.table-bordered
>
colgroup
+
tbody
>
tr
:first-child
>
td
:first-child
{
.table-bordered
>
colgroup
+
tbody
>
tr
:first-child
>
td
:first-child
{
border-top-left-radius
:
4px
;
border-top-left-radius
:
4px
;
}
}
.table-bordered
>
caption
+
thead
>
tr
:first-child
>
th
:last-child
,
.table-bordered
>
caption
+
thead
>
tr
:first-child
>
th
:last-child
,
.table-bordered
>
caption
+
tbody
>
tr
:first-child
>
td
:last-child
,
.table-bordered
>
colgroup
+
thead
>
tr
:first-child
>
th
:last-child
,
.table-bordered
>
colgroup
+
thead
>
tr
:first-child
>
th
:last-child
,
.table-bordered
>
caption
+
tbody
>
tr
:first-child
>
td
:last-child
,
.table-bordered
>
colgroup
+
tbody
>
tr
:first-child
>
td
:last-child
{
.table-bordered
>
colgroup
+
tbody
>
tr
:first-child
>
td
:last-child
{
border-top-right-radius
:
4px
;
border-top-right-radius
:
4px
;
}
}
...
...
This diff is collapsed.
Click to expand it.
less/tables.less
+
62
-
44
View file @
da072fff
...
@@ -19,27 +19,31 @@ th {
...
@@ -19,27 +19,31 @@ th {
width: 100%;
width: 100%;
margin-bottom: @line-height-computed;
margin-bottom: @line-height-computed;
// Cells
// Cells
thead > tr > th,
thead,
tbody > tr > th,
tbody {
thead > tr > td,
> tr {
tbody > tr > td {
> th,
padding: 8px;
> td {
line-height: @line-height-base;
padding: 8px;
vertical-align: top;
line-height: @line-height-base;
border-top: 1px solid @table-border-color;
vertical-align: top;
border-top: 1px solid @table-border-color;
}
}
}
}
// Bottom align for column headings
// Bottom align for column headings
thead > tr > th {
thead > tr > th {
vertical-align: bottom;
vertical-align: bottom;
}
}
// Remove top border from thead by default
// Remove top border from thead by default
caption + thead tr:first-child th,
caption + thead,
caption + thead tr:first-child td,
colgroup + thead,
colgroup + thead tr:first-child th,
thead:first-child {
colgroup + thead tr:first-child td,
tr:first-child {
thead:first-child tr:first-child th,
th, td {
thead:first-child tr:first-child td {
border-top: 0;
border-top: 0;
}
}
}
}
// Account for multiple tbody instances
// Account for multiple tbody instances
tbody + tbody {
tbody + tbody {
...
@@ -58,11 +62,14 @@ th {
...
@@ -58,11 +62,14 @@ th {
// -------------------------------
// -------------------------------
.table-condensed {
.table-condensed {
thead > tr > th,
thead,
tbody > tr > th,
tbody {
thead > tr > td,
> tr {
tbody > tr > td {
> th,
padding: 4px 5px;
> td {
padding: 4px 5px;
}
}
}
}
}
}
...
@@ -77,11 +84,14 @@ th {
...
@@ -77,11 +84,14 @@ th {
border-left: 0;
border-left: 0;
border-radius: @border-radius-base;
border-radius: @border-radius-base;
> thead > tr > th,
> thead,
> tbody > tr > th,
> tbody {
> thead > tr > td,
> tr {
> tbody > tr > td {
> th,
border-left: 1px solid @table-border-color;
> td {
border-left: 1px solid @table-border-color;
}
}
}
}
// Prevent a double border
// Prevent a double border
> caption + thead > tr:first-child th,
> caption + thead > tr:first-child th,
...
@@ -131,15 +141,16 @@ th {
...
@@ -131,15 +141,16 @@ th {
}
}
// Special fixes to round the left border on the first td/th
// Special fixes to round the left border on the first td/th
> caption + thead > tr:first-child > th,
> caption,
> caption + tbody > tr:first-child > td,
> colgroup {
> colgroup + thead > tr:first-child > th,
+ thead > tr:first-child > th,
> colgroup + tbody > tr:first-child > td {
+ tbody > tr:first-child > td {
&:first-child{
&:first-child {
border-top-left-radius: @border-radius-base;
border-top-left-radius: @border-radius-base;
}
}
&:last-child{
&:last-child {
border-top-right-radius: @border-radius-base;
border-top-right-radius: @border-radius-base;
}
}
}
}
}
}
}
...
@@ -152,9 +163,11 @@ th {
...
@@ -152,9 +163,11 @@ th {
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
.table-striped {
> tbody {
> tbody {
> tr:nth-child(odd) > td,
> tr:nth-child(odd) {
> tr:nth-child(odd) > th {
> td,
background-color: @table-bg-accent;
> th {
background-color: @table-bg-accent;
}
}
}
}
}
}
}
...
@@ -167,9 +180,11 @@ th {
...
@@ -167,9 +180,11 @@ th {
// Placed here since it has to come after the potential zebra striping
// Placed here since it has to come after the potential zebra striping
.table-hover {
.table-hover {
> tbody {
> tbody {
> tr:hover > td,
> tr:hover {
> tr:hover > th {
> td,
background-color: @table-bg-hover;
> th {
background-color: @table-bg-hover;
}
}
}
}
}
}
}
...
@@ -184,10 +199,13 @@ table col[class^="col-"] {
...
@@ -184,10 +199,13 @@ table col[class^="col-"] {
float: none;
float: none;
display: table-column;
display: table-column;
}
}
table td[class^="col-"],
table {
table th[class^="col-"] {
td, th {
float: none;
&[class^="col-"] {
display: table-cell;
float: none;
display: table-cell;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment