html - 需要帮忙。基本的 HTML/CSS。标题不变色

标签 html css colors header css-selectors

我需要帮助。我刚刚开始使用 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;}

谁能指出我哪里出错了

最佳答案

改变:

nav { ... }

收件人:

#nav { ... }

关于html - 需要帮忙。基本的 HTML/CSS。标题不变色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15293011/

相关文章:

algorithm - 查找颜色相似的图像

r - R中的网格颜色

html - 溢出隐藏导致子元素出现在自己的行

python - 如何仅使用 python-requests 在 Github 中获取最新版本?

html - 一行中的两个输入字段

angular - 在 Angular Material 中添加自定义颜色变量 (2+)

javascript - show() 函数似乎没有按预期工作

html - 如何将此 CSS 转换为 webkit

HTML/CSS 如何水平对齐这些元素?

css - 努力使用 float 按预期排列元素