【问题标题】:Use overflow hidden to make content not wrap使用溢出隐藏使内容不换行
【发布时间】:2013-03-17 10:41:17
【问题描述】:

我想要这个:

但我明白了:

使用它来设置包含 div 的样式:

.option {
    display:inline-block;
    width:100%;
    white-space:nowrap;
    overflow:hidden;
    margin:10%;
}

剩下的就是 nothinghttp://jsfiddle.net/n2LtN/

缺少什么?

【问题讨论】:

    标签: css overflow nowrap


    【解决方案1】:

    我通过使用 display:inline-block 而不是 display:inline 来修复它,没有 floating

    span, input[type="checkbox"] {
        display:inline-block;
        *display:inline; /*That's for IE*/
        *zoom:1; /*That's for IE*/
        width:auto;
    }
    

    查看工作中的fiddle

    【讨论】:

      【解决方案2】:

      span, input[type="checkbox"] 中删除float:left

      您应该阅读浮动的工作原理。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-24
      • 2020-04-15
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      相关资源
      最近更新 更多