为什么页面在IE8和chm中显示不同(CSS“display:inline block”问题)

为什么页面在IE8和chm中显示不同(CSS“display:inline block”问题),css,internet-explorer-8,chm,Css,Internet Explorer 8,Chm,在使用IE8的Windows7上,我发现display:inline block工作得非常好。但是,在我将html文件编译成chm后,chm中的页面显示不好,好像inline block没有任何效果 有没有办法让chm显示与IE8相同的内容?多谢各位 我的html源代码是: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> &l

在使用IE8的Windows7上,我发现
display:inline block
工作得非常好。但是,在我将html文件编译成chm后,chm中的页面显示不好,好像
inline block
没有任何效果

有没有办法让chm显示与IE8相同的内容?多谢各位

我的html源代码是:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>title to fill</title>
<meta charset="utf-8">
<style type="text/css">
#topcanvas {
    z-index: 0;
    top: 0; 
    left:0;
    width:100%;
}

#chjnavi {
    font-size: 10pt;
    background-color: #eee;

    padding: 0em 1em;
    list-style-type: none;  
    position: relative;
    z-index: 0;
}

#chjnavi ul {
    margin: 0;
    padding: 0;
}

#chjnavi li {
    margin: 0;
    padding: 8px;
    display: inline-block;
        /* !!! */

    cursor: pointer;
}

</style>
</head>

<div id="topcanvas">
<div id="chjnavi">
    <ul id="navibar_topul">
        <li id="gentoc-t">item 1</li>
        <li id="codecolor-t">item 2</li>
        <li id="linenum-t">item 3</li>
    </ul>
</div>
</div>
<p> My text. </p>
</body>
</html>

要填写的标题
#顶帆布{
z指数:0;
排名:0;
左:0;
宽度:100%;
}
#切纳维{
字号:10pt;
背景色:#eee;
填充:0em 1em;
列表样式类型:无;
位置:相对位置;
z指数:0;
}
#切纳维{
保证金:0;
填充:0;
}
#李奇那维{
保证金:0;
填充:8px;
显示:内联块;
/* !!! */
光标:指针;
}
    第1项 第2项 第3项
我的文本


使用float:left代替内联块;对于IE8,因为它不支持内联块的属性

这就是您必须添加到代码中的内容

#chjnavi li {
    margin: 0;
    padding: 8px;
    display: inline-block;
    cursor: pointer;
    float:left\9; /* This works for IE8 and below  so apply this to your code*/
}

我终于找到了答案。告诉我,我需要做一个注册表黑客让CHM阅读器(hh.exe)使用IE8呈现模式,否则,hh.exe最多使用IE7

注册表黑客是:将以下代码保存到.reg文件中,然后双击导入注册表

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"hh.exe"=dword:00001f40
嗯。至少有一个IE8 M$系统的解决方案


这个问题与

请问“left\9”中的\9是什么意思有关?您的代码仍然使用
内联块
,这与您对“而不是内联块”的看法相反。\9是一个用于IE的黑客。这行代码是在您的css之后添加的。这只适用于IE,不会影响其他浏览器。代码中的内联块并不重要,因为这将适用于其他浏览器,因为无论如何,内联块在IE中都不起作用。为了防止有人需要它,这里提供了正确的答案:这个答案严重破坏了视图在我的情况下…这个黑客的警告:变化是全球性的,这意味着所有CHM内容将使用更新的IE版本显示。这可能会导致希望使用IE7的其他(旧的)帮助文件出现问题。就我个人而言,我没有任何问题,但在你改变人类机器的全球设置之前,最好记住这一点。