我正在编写Shay Howe先生的书学习代码:HTML和CSS ,并遇到了我的代码问题。
我使用Adobe的Brackets作为我的文本编辑器,当我查看我的实时预览时,它看起来不应该看起来如此,所以我将它放入W3C CSS验证服务,它说我有一个解析错误。这是我的代码(问题区域):
h1, h3, h4, h5, p {
margin-bottom: 22px;
}
<a class="btn-alt"></a>
/*
==============================================
Buttons
==============================================
*/
.btn {
border-radius: 5px;
display: inline-block;
margin; 0;
}
.btn-alt {
border: 1px solid #dfe2e5;
padding: 10px 30px;
}
我的HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Styles Conference</title>
<link rel="stylesheet" href="assets/stylesheets/stylesconference.css">
</head>
<header>
<section class="container">
<h1>
<a href="stylesconference.html">Styles Conference</a>
</h1>
</section>
<h3>August 24—26th — Chicago, IL</h3>
<nav>
<a href="stylesconference.html">Home</a>
<a href="speakers.html">Speakers</a>
<a href="schedule.html">Schedule</a>
<a href="venue.html">Venue</a>
<a href="register.html">Register</a>
</nav>
</header>
<header class="container"></header>
<section>
<h2>Dedicated to the Craft of Building Websites</h2>
<p>Every year, the brightest web designers and front-end developers descend on Chicago to discuss the latest technologies. Join us this August!</p>
<a href="register.html">Register Now</a>
</section>
<section class="hero container"></section>
<section>
<section>
<a href="speakers.html">
<h5>Speakers</h5>
<h3>World-Class Speakers</h3>
</a>
<p>Joining us from around the world are over twenty fantastic speakers, here to share their stories.</p>
</section>
<section class="container"></section>
<section>
<a href="schedule.html">
<h5>Schedule</h5>
<h3>Three Inspiring Days</h3>
</a>
<p>Enjoy three inspiring and action-packed days of talks, gatherings, and all-around good times.</p>
</section>
<section>
<a href="venue.html">
<h5>Venue</h5>
<h3>The Chicago Theatre</h3>
</a>
<p> Within the heart of downtown Chicago, The Chicago Theatre will provide a beautiful conference venue.</p>
</section>
</section>
<section class="container"></section>
<footer>
<small>© Styles Conference</small>
<nav>
<a href="stylesconference.html">Home</a>
<a href="speakers.html">Speakers</a>
<a href="schedule.html">Schedule</a>
<a href="venue.html">Venue</a>
<a href="register.html">Register</a>
</nav>
</footer>
<footer class="container"></footer>
</html>
答案 0 :(得分:3)
CSS文件的第5行有一个HTML标记:
<a class="btn-alt"></a>
我不知道这是实际代码中的拼写错误还是您在此处发布的结果,但这是一个问题。
当它应该是第16行的冒号时,还有一个分号,这是.btn
类的最后一种风格:
margin; 0;
这应该是:
margin: 0;
答案 1 :(得分:0)
只需删除标记<a class="btn-alt"></a>
即可,