From: Mark Otto Date: Mon, 17 Jun 2013 21:19:44 +0000 (-0700) Subject: Better clearing on `.dl-horizontal` for empty `dd` elements X-Git-Tag: v3.0.0-rc1~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37f4a25be436e8b25004d22541809032d8354600;p=thirdparty%2Fbootstrap.git 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. --- diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index 04d5bc1fd9..a99125994f 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -548,38 +548,38 @@ dd { margin-left: 10px; } -.dl-horizontal:before, -.dl-horizontal:after { - display: table; - content: " "; +.dl-horizontal dt { + float: left; + width: 160px; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; } -.dl-horizontal:after { - clear: both; +.dl-horizontal dd { + margin-left: 180px; } -.dl-horizontal:before, -.dl-horizontal:after { +.dl-horizontal dd:before, +.dl-horizontal dd:after { display: table; content: " "; } -.dl-horizontal:after { +.dl-horizontal dd:after { clear: both; } -.dl-horizontal dt { - float: left; - width: 160px; - overflow: hidden; - clear: left; - text-align: right; - text-overflow: ellipsis; - white-space: nowrap; +.dl-horizontal dd:before, +.dl-horizontal dd:after { + display: table; + content: " "; } -.dl-horizontal dd { - margin-left: 180px; +.dl-horizontal dd:after { + clear: both; } hr { diff --git a/less/type.less b/less/type.less index a74bdaeffe..9a6811e3d3 100644 --- a/less/type.less +++ b/less/type.less @@ -149,7 +149,6 @@ dd { } // Horizontal layout (like forms) .dl-horizontal { - .clearfix(); // Ensure dl clears floats if empty dd elements present dt { float: left; width: (@component-offset-horizontal - 20); @@ -158,6 +157,7 @@ dd { .text-overflow(); } dd { + .clearfix(); // Clear the floated `dt` if an empty `dd` is present margin-left: @component-offset-horizontal; } }