Commit 37f4a25b authored by Mark Otto's avatar Mark Otto

Better clearing on `.dl-horizontal` for empty `dd` elements

Instead of clearing the entire `.dl-horizontal`, we've moved the
clearfix mixin to the `dd` level to solve two problems in one: empty
`dd`s mid-list, and empty `dd` as the last child.

Addresses a few old issues, including #2824, #3819, #3821, #4062,
#6707, and #7180.

Sorry that took so long :D.
parent 4436e727
...@@ -548,38 +548,38 @@ dd { ...@@ -548,38 +548,38 @@ dd {
margin-left: 10px; margin-left: 10px;
} }
.dl-horizontal:before, .dl-horizontal dt {
.dl-horizontal:after { float: left;
display: table; width: 160px;
content: " "; overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
} }
.dl-horizontal:after { .dl-horizontal dd {
clear: both; margin-left: 180px;
} }
.dl-horizontal:before, .dl-horizontal dd:before,
.dl-horizontal:after { .dl-horizontal dd:after {
display: table; display: table;
content: " "; content: " ";
} }
.dl-horizontal:after { .dl-horizontal dd:after {
clear: both; clear: both;
} }
.dl-horizontal dt { .dl-horizontal dd:before,
float: left; .dl-horizontal dd:after {
width: 160px; display: table;
overflow: hidden; content: " ";
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
} }
.dl-horizontal dd { .dl-horizontal dd:after {
margin-left: 180px; clear: both;
} }
hr { hr {
......
...@@ -149,7 +149,6 @@ dd { ...@@ -149,7 +149,6 @@ dd {
} }
// Horizontal layout (like forms) // Horizontal layout (like forms)
.dl-horizontal { .dl-horizontal {
.clearfix(); // Ensure dl clears floats if empty dd elements present
dt { dt {
float: left; float: left;
width: (@component-offset-horizontal - 20); width: (@component-offset-horizontal - 20);
...@@ -158,6 +157,7 @@ dd { ...@@ -158,6 +157,7 @@ dd {
.text-overflow(); .text-overflow();
} }
dd { dd {
.clearfix(); // Clear the floated `dt` if an empty `dd` is present
margin-left: @component-offset-horizontal; margin-left: @component-offset-horizontal;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment