html - 在 IE 5.5 - 7 中对 Angular 显示的 CSS 水平导航栏

标签 html css internet-explorer

导航栏在 IE 8 及更高版本和所有其他浏览器中以正确的方式(水平)显示。但是,它仅对 Angular 显示 IE 5.5、6 和 7。任何机构都可以提供帮助吗?

.top-nav ul {
margin: 0;
list-style: none;
line-height: normal;
}

.top-nav li {
margin-left: 220px;
}

.top-nav a {
display: block;
float: left;
height: 38px;
margin-right: 1px;
padding: 4px 30px 0 30px;
text-decoration: none;
font-size: 34px;
font-weight: bold;
font-family: 'Exo', sans-serif;
color: #FFF;
}

.top-nav a:hover {
background:  #272727;
color: #18942f;
}

.top-nav .current_page_item a {
background:  #252525;
color: #FFF;
}

HTML

<div class="top-nav"> 
  <ul> 
    <li><a href="index.html" class="links">Home</a></li> 
    <li><a href="aboutme.html" class="links">About Me</a></li> 
    <li><a href="skills.html" class="links">Skills</a></li> 
    <li class="current_page_item"> <a href="#">Contact</a></li> 
    </ul> 
</div>

here's a screenshot

最佳答案

为什么不在你的 li 上使用 display:inline 而不是 float 每个链接,display: inline 在 IE 5.5 上工作

您还需要删除“display: Block”,因为这是导致链接向下移动的原因。

.top-nav ul {
margin: 0;
list-style: none;
line-height: normal;
}

.top-nav li {
 display: inline;
}

.top-nav a {
height: 38px;
margin-right: 1px;
padding: 4px 30px 0 30px;
text-decoration: none;
font-size: 34px;
font-weight: bold;
font-family: 'Exo', sans-serif;
color: #aaa;
}​

http://jsfiddle.net/YJjya/


如果你需要让你的元素成为 block ,那么使用内联 block 。可以在此处找到使其在旧版本或 IE 上运行的解决方法:Work Around Inline Block


这里还有一段方便的代码,可以紧跟在您的第一个 head 标签之后。它只会显示用户使用的是 IE 7 或更高版本,并会告诉他们把他们的垃圾放在一起并下载一个新的浏览器。真的不值得花时间尝试让您的网站在每个 IE 版本上工作,因为您最终会竭尽全力取悦一些显然一开始就不懂互联网的人。正如马里奥所说,世界上只有 6% 的人仍在使用 IE6...但是如果你仔细观察美国或英国等国家/地区,这个数字低于 1%

后头

<!--[if lt IE 7]>
    <p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->

CSS

.chromeframe {
    margin: 0.2em 0;
    background: #ccc;
    color: #000;
    padding: 0.2em 0;
}

关于html - 在 IE 5.5 - 7 中对 Angular 显示的 CSS 水平导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13258438/

相关文章:

css - 试图理解 <div> 元素

javascript - 如何让 IE 10 显示指针而不是选择列表的 I-bar?

javascript - 包含 PHP 页面并在单击链接时替换 div

html - CSS 表格列宽 : fixed - dynamic(30%) - dynamic(70%) - fixed

javascript - 使用 jQuery 循环遍历多个表的行以获取某些值

javascript - 在主 div 之后插入一个空 div

html - Css 第 n 个 child :hover ~ first-child {. ..}

css - IE 7 不显示全尺寸链接

css - IE 8 & 9 忽略 div 宽度 - 如何让这个例子工作?

javascript - IE 9 忽略 display none 对于 select 的选项