我正在尝试在消息栏中 float 一个跨度。由于某种原因,在我的网页中,右浮动跨度在视觉上出现在 div 下方。在 JS fiddle 中看起来还不错。什么可能会压低它?
HTML:
<div class="msg">
Some thext here
<span class="goright">Close</span>
</div>
CSS:
.msg {
background-color: green;
}
.goright {
float:right;
}
最佳答案
我相信这只是 IE7 及以下版本中的问题,其中内容本身将 float 元素向下推。在现代浏览器中,不应将其推下。但要解决这个问题,将 float 范围放在内容之前应该可以工作。
<div class="msg">
<span class="goright">Close</span>
Some thext here
</div>
关于css - 右浮动跨度似乎不在父 div 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11228427/