0

我需要帮助。我刚刚开始使用 CSS/HTML,我之前能够使用 CSS 更改网站中页面 header1 内容的颜色。现在我尝试了完全相同的代码行,它保持纯黑色。

这是HTML:

<!DOCTYPE HTML>
<html lang = "en">
<head>
<title>Pacific Trails Resort</title>
<link rel ="stylesheet" href="pacific.css">
<meta charset="utf-8">
</head> 
<body>
<h1>Pacific Trails Resort</h1>
<div id="nav"><b>
<a href ="index.html">Home</a>&nbsp;&nbsp;
<a href ="yurts.html">Yurts</a>&nbsp;&nbsp;
<a href ="activities.html">Activities</a>&nbsp;&nbsp;
<a href ="reservations.html">Reservations</a>&nbsp;&nbsp;
</b></div>
<div id ="content">
<h2>Enjoy Nature In Luxury</h2>
<p><span class="resort">Pacific Trails Resort</span> offers a special lodging experience on the California North Coast.Relax 
in sereninty with panoramic views of the Pacific Ocean.</p>
<ul>
<li>Private yurts with decks overlooking the ocean
<li>Activities lodge with fireplace and gift shop
<li>Nightly fine dining at the Overlook Cafe
<li>Heated outdoor pool and whirlpool
<li>Guided hiking tours of the redwoods
</ul>
<div id="contact">
<span class="resort">Pacific Trails Resort</span>
<br>12010 Pacific Trails Road
<br>Zephyr, CA 95555
<br>
<br>888-555-5555
</div>
<div id="contact"><small><i>
Copyright &copy; 2011 Pacific Trails Resort
<br><a href= "mailto:nathan@griffin.com"> nathan@griffin.com</a>
</i></small></div>
</div>
</body>
</html>

这是 CSS 文件。(在 w3 网站上验证)

body{
    color: #666666;
    background-color: #ffffff;}
h1{
    color: #000033;
    background-color: #ffffff;
    margin-bottom: 0;}
nav{
    background-color: #90c7e3;}
h2{
    color: #3399cc;}
dt{
    color: #000033;}
.resort{
    color: #000033;}

有人可以指出我哪里出错了吗

4

2 回答 2

3

改变:

nav { ... }

到:

#nav { ... }
于 2013-03-08T11:40:46.173 回答
0

对我来说似乎很好。

请注意,您将其设置为#000033,这是一种非常深的蓝色(应用正确,但可能会因为它类似于黑色而被忽略)。

当我随意将其更改为不同的颜色(即#BADA55)时,它仍然可以正常工作并且更明显。

于 2013-03-08T11:38:42.443 回答