我正在努力实现以下目标,如果标签的内容从一行流到另一行,则将标签移至新行,这样您就可以明白我的意思了 http://jsfiddle.net/sNyzX/第一个示例(红色)显示了我现在的情况,第二个示例(橙色)显示了所需的效果,但是没有那个 <br>
标签。这可以用纯 html 和 css 实现吗,如果不是,jQuery 解决方案也可以。
<div id="example1">
Hi there This is some text and <a href="#"> this is the link! </a>
</div>
<div id="example2">
Hi there This is some text and <br> <a href="#"> this is the link! </a>
</div>
CSS:
#example1 {
background: red;
width: 145px;
}
#example2 {
background: orange;
width: 145px;
margin-top: 20px;
}
最佳答案
添加:
a {
white-space: pre;
}
关于jquery - 如果内容从第一行流出,请将 <a> 标记移至新行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16625021/