浮动右移在IE 7中不起作用,但在FF IE8中起作用 [英] Float right is not working in IE 7 but works in FF IE8

查看:100
本文介绍了浮动右移在IE 7中不起作用,但在FF IE8中起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码

<div id="facebook_bar"> 
  <div style="float:left;">
  <img src="images/topbar_followus.png" width="70" height="25" /> 
  <img src="images/topbar_twitIcon.png" width="30" height="25" /> 
  <img src="images/topbar_fbicon.png" width="30" height="25" />
  </div>
    <div id="newsletter_box"> 


   <img src="images/topbar_subscribe.png" width="220" height="25" />
      <input type="text" name="cm-ktkykk-ktkykk" id="ktkykk-ktkykk" />
      <input type="image" src="images/btn_submit.png" width="55" height="25" />

      </div>
  </div>

css是

#facebook_bar {
 background-color:#323334;
 height:30px;
 padding-top:15px;
 padding-left:20px;
 padding-right:20px;
}
#newsletter_box {
 float:right;
 /*margin-top:-30px;*/

}

右div显示在第一个div之后的下一行而不是同一行

The right hand div is showing on next line after the first div not on the same line

推荐答案

我最初将其发布为评论,但也可能将其作为答案.

I initally posted this as a comment but might as well give you it as an answer.

为什么不对#newsletter_box和内联浮动div都同时使用float:left.这样可以确保它们在垂直方向上都位于同一位置,然后您可以使用%宽度来调整水平位置.

Why don't you just use float:left for both #newsletter_box and the inline floated div. This will ensure they both sit at the same position vertically, you can then adjust the horizontal positioning using % widths.

我还会查看文章以清除浮动信息,因为您有图像.

I'd also check out this article to clear the float because you have images involved.

这篇关于浮动右移在IE 7中不起作用,但在FF IE8中起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆