css - IE7 定义列表 float 清除

标签 css css-float internet-explorer-7

我有一个定义列表,我想用彼此相邻的标签/定义对来显示它。

以下代码在所有现代浏览器中都能正常工作。我试图让它在 IE7 中工作,但 dd 值不符合先前清除的 dt。我还需要做什么才能让它们像在 chrome 或 ff 中那样堆叠。

<style type="text/css">
   .label-value-list {
    }
   .label-value-list dt {
      float: left;
      clear: left;
      width: 100px;
   }
   .label-value-list dd {                           
      float: left;
   }
</style>

<dl class="label-value-list">
   <dt>First Label</dt>
   <dd>This is the first value</dd>

   <dt>Second Label</dt>
   <dd>I should be below the first value<br/>and I have two lines</dd>

   <dt>Third Label</dt>
   <dd>I should be below the second value</dd>
</dl>

最佳答案

添加

*:first-child+html .label-value-list dd {
   float: none;
   display: inline-block;
}

到你的 CSS。

参见 http://jsfiddle.net/FFMvY/1/

关于css - IE7 定义列表 float 清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13829541/

相关文章:

html - 无法在页面底部设置页脚

css - HTML/CSS : floating divs height and bottom vertical align

javascript - jquery 删除兄弟元素,在 IE7 中不起作用

javascript - 如何使用 javascript 或 jquery 检测 IE7 并将类添加到 div

html - 将 div 对齐到底部并应用边距

javascript - WordPress 自定义表单

css - 如何让内容在背景图片之后开始(响应式)?

css - 如何对齐 float 元素,使其底部匹配

html - CSS:如何 float :右和居中

html - IE 7-8 中的 jqGrid 在编辑/添加时在内容之上创建灰色区域而不是在其之上