我使用了html + CSS来创建导航栏。当我将HTML和CSS放在我的“Documents”文件夹中时,一切都运行良好,但当它放在“网络”文件夹中时它不起作用。通过IE9打开时找不到CSS样式。铬合金很好。 有谁知道原因?
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Projects</title>
<link type="text/css" rel="stylesheet" href="Index.css"/>
</head>
<body>
<!-- Navigation Bar -->
<nav id="topNav">
<ul>
<li><a href="index.html" title="A">A</a></li>
<li>
<a href="Projects-Main.html" title="Projects">Projects</a>
<ul>
<li><a href="Projects-A.html" title="A">A</a></li>
<li><a href="Projects-B.html" title="B">B</a></li>
<li><a href="Projects-C.html" title="C">C</a></li>
<li><a href="Projects-D.html" title="D">D</a></li>
<li><a href="Projects-E.html" title="E">E</a></li>
<li><a href="Projects-F.html" title="F">F</a></li>
<li><a href="Projects-G.html" title="G">G</a></li>
<li class="last"><a href="Projects-H" title="H">H</a></li>
</ul>
</li>
<li><a href="Services.html" title="Nav Link 1">Sevices</a>
<ul>
<li><a href="Services.html" title="AA">AA</a></li>
<li><a href="Services.html" title="BB">BB</a></li>
</ul>
</li>
<li><a href="#" title="Nav Link 1">Contacts</a></li>
</nav>
<!-------------------------------------------------------------------------------------------->
</body>
</html>
CSS是:
h1 { font-family: Georgia, "Times New Roman", Times, serif;
font-size: 120%;
font-style: italic;
text-decoration:underline;}
/*---------------------------------------------------------------*/
/*Navigation Bar*/
nav {
display:block;
font:16px arie, Sans-serif ;
border-top:2px solid ;
border-bottom:2px solid;
border-color:#F2F2F2;
width:400px;
float:right;
margin: 35px 30px 0px 0px;
z-index:10;}
nav ul {padding:0; margin:0; }
nav li {position:relative; float:right; list-style-type:none; }
nav ul:after { content:"."; display:block; height:0; clear:both; visibility:hidden; }
nav li a { display:block; padding:8px 20px; ; color:#8E8E8E; text-decoration:none;}
nav li a:focus { outline:none; text-decoration:underline; }
nav ul ul { display:none; width:100%; position:absolute; right:0; background:#F2F2F2; text-align: right}
nav ul ul li { float:none; border:solid #FFF 1px; }
nav ul ul a { padding:5px 10px;font-size:16px; }
nav ul ul a:hover { background-color:#555; }
答案 0 :(得分:0)
我还不能发表评论,所以我需要为此做出完整的回答...... 您是否尝试过绝对确定“index.css”与其他文件存在于同一文件夹中?我尝试过这个,它适用于所有浏览器。您是否加倍检查它确实是.css文件,并且该名称是正确的?
答案 1 :(得分:-1)
尝试在css参考中添加斜杠:
<link type="text/css" rel="stylesheet" href="/Index.css"/>