html - IE8 float 问题再次出现

标签 html css internet-explorer-8 css-float

上下文

在我的页眉中,我想将我的小登录菜单“登录”和“帮助”放在页面右侧,与左侧的 Logo (红色矩形)高度相同。

问题

布局不适用于 IE8。

它在 Chrome 上按预期工作:

enter image description here

但它在 IE8 上给出了这个:

enter image description here

或者这个:

enter image description here

代码

HTML

<header class="header">
    <div class="Login">
        <a id="LB_GotoLogin" tabindex="30" href="javascript:__doPostBack('ctl00$MainContent$LB_GotoLogin','')">LOGIN</a>
        <br><br>
        <a id="LB_Help" tabindex="30" href="javascript:__doPostBack('ctl00$MainContent$LB_Help','')">Help</a>
    </div>
    <a href="/Default.aspx" style="text-decoration: none; display: inline-block; *display: inline; *zoom: 1;">
        <img src="Logo.jpg" style="height:64px;border: 0;">
    </a>
</header>

CSS

.header
{
    padding: 18px 50px;
    margin: 0px auto;
    text-align: left;
    line-height: normal;
    height: 64px;
}

.login
{
    float: right;
    vertical-align: top;
    display: inline-block;
    *display: inline;
    *zoom: 1;
    width: 100px;
}

我尝试了什么

  1. 我尝试将右浮动元素(登录名)放置在 Logo 之前,它给出了我包含的第一个 IE8 图像而不是第二个。 (如所述 Here )
  2. 我在多个位置为 float 元素设置了宽度。
  3. 每个容器都是<div>秒。如前所述 Here , IE8 不识别其他标签。
  4. 尝试制作所有东西 inline-blocks使用 IE8 hack (`*dispay: inline; *zoom: 1;)

没有任何效果。

问题

如何使我的布局适用于 IE8? (我错过了什么?)

最佳答案

正如 Niet the Dark Absol 指出的那样,

Class "login" and class "Login" are two different classes. Some browsers may be tolerant of this (but they shouldn't be), IE8 is not.

Internet Explorer 8 区分大小写,而其他浏览器不区分大小写。

使用完全相同的类名可以解决问题。

关于html - IE8 float 问题再次出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25140143/

相关文章:

带有行跨度的 jquery 无表布局

html - :hover:not() execption responds only to the . 事件类?

javascript - 如何使用 Javascript 在 chrome 中禁用保存密码气泡?

html - Z-index 不适用于 IE

javascript - 单击按钮时,突出显示文本框的全部内容(youtube 分享)

php - 仅当选中该框时才发送当前日期

javascript从div复制文本到输入

css - 移动设备的不同 css - chrome 测试 - 一些 css 不工作

javascript - 加载 gif 不等待 iFrame 加载?

javascript - 这个 JS RegEx 会在 IE7 和 IE8 中失败,但在 IE9 中不会失败,这是怎么回事?