我有很多时间忙于学习 HTML,我决定制作 wamp 服务器。一切顺利,我开始编写 HTML 代码。但是当我开始编写 CSS 代码时,选择器将不会显示在我本地域 (rolfweb.net:8080) 的网页中。但在 localhost 中它正确显示了所有 CSS! 代码:
<DOCTYPE html>
<html>
<head>
<title> RolfWeb </title>
</head>
<body>
<link type="text/css" rel="stylesheet" href="/css/indexss.css"/>
<nav>
<ul>
<li> Home </li>
<li> Video's </li>
<li> Games </li>
<li> Contact en informatie </li>
<li> Over mij </li>
</ul>
</nav>
<p> Test </p>
<footer>
</footer>
</body>
</html>
还有 CSS:
p {
color: blue;
}
/* This is not working! */
nav ul {
list-style-type: none;
background-color: #3f875f;
border: 3px solid #3a756c;
text-align: center;
}
因此它在 localhost 上显示良好,但在 rolfweb.net:8080 上显示不正常。
PS:抱歉我的英语不好,我是荷兰人 :P
最佳答案
在 head 标签内移动你的 css 链接:-
<DOCTYPE html>
<html>
<head>
<title> RolfWeb </title>
<link type="text/css" rel="stylesheet" href="/css/indexss.css"/>
</head>
<body>
<nav>
<ul>
<li> Home </li>
<li> Video's </li>
<li> Games </li>
<li> Contact en informatie </li>
<li> Over mij </li>
</ul>
</nav>
<p> Test </p>
<footer>
</footer>
关于html - CSS(选择器)在 WAMP 服务器 (W10) 上不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40074483/