【问题标题】:Inline clearfix before <strong> in css<strong> 之前的内联 clearfix 在 css 中
【发布时间】:2011-12-31 19:05:10
【问题描述】:

我想在&lt;strong&gt; 标记开始之前自动换行。我会尝试几件事,但不知道该怎么做。

我试过了:

strong, b {font-weight: bolder;clear:both;display:block;}

strong:before, b:before {clear:both;display:block;height:1%}
strong, b {font-weight: bolder;}

有什么解决办法吗?

【问题讨论】:

  • 不能对内联元素应用 clear,它会自动恢复为“内联”。
  • display: block; 不是内联的。问题是块内的内容为空(不同于空),因此它甚至不会显示 :before 元素。添加content: "" 就是他所需要的。

标签: html tinymce css clearfix


【解决方案1】:

这里

strong:before {
    content: "";
    display: table;
    clear: both;
    zoom: 1.0;
}

http://jsfiddle.net/dxQBy/8/

几周前我在遇到A new micro clearfix hack - Nicholas Gallagher 后得知了这一点

【讨论】:

    【解决方案2】:

    你不是在寻找这样的东西吗?

    strong, b { 
        font-weight: bold;
        display:block;
        clear: both;
    }
    

    http://jsfiddle.net/seany789/dxQBy/4/

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-04
    • 2011-04-10
    • 2022-01-06
    • 2013-06-11
    • 1970-01-01
    • 2020-05-06
    • 1970-01-01
    • 2012-09-03
    相关资源
    最近更新 更多