我使用内部css,每当用任何浏览器测试时,样式都不会应用于标签。我已经验证了我的代码并且它已经通过。我不知道我哪里出错了。 如果有人可以通过浏览器查看此页面来帮助我吗?谢谢。
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Extend Your Knowledge - 3-1</title>
<style type="text/css">
<!--
body {font-family:"Garamond,Arial,Verdana; font-size:12pt;}
h1,h2 {color:red ;
font-variant:small-caps;}
.align-right {float:right;
margin-left:15px;
margin-right:15px;}
.align-left {float:left;
margin-left:15px;
margin-right:15px; }
a {text-decoration:underline;
color:red;}
a:hover {background:red;
color:white;}
-->
</style>
</head>
<body>
<section>
<article>
<a id="top"></a>
<h1>Isabel's Desserts</h1>
<p>We offer a variety of wonderful desserts at our cafe such as <a href="#eggnog">eggnog mousse</a> as well as <a href="#custard">decorative custards</a>.</p>
<a id="eggnog"></a>
<h2>Eggnog Mousse</h2>
<img class="align-left" src="mousse.jpg" width="560" height="420" alt="First dessert" />
<p>This first dessert is delicious. The mousse is light and fluffy and is always a customer favorite.</p>
<br style="clear-left" />
<br /> <br /><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<a href="#top">To top</a>
<a id="custard"></a>
<h2>Decorative Custards</h2>
<img class="align-right" src="custard.jpg" width="280" height="420" alt="Second dessert" />
<p>This second dessert comes in several flavors, including chocolate, vanilla, and butterscotch. The custard is often selected as the dessert for special occasions.</p>
<br style="clear:right" />
<br/><br/>
<a href="#top">To top</a>
</article>
</section>
</body>
</html>
答案 0 :(得分:5)
错别字:
body {font-family:"Garamond,Arial,Verdana; font-size:12pt;}
^-- missing "
你真的应该检查浏览器的调试控制台(例如Firefox中的shift-ctrl-j),它会告诉你这个。 css文件中的任何错误都会在错误发生后终止所有规则。由于html注释和"
语法错误,基本上你忽略了整个css规则集。
答案 1 :(得分:2)
错误在以下行中 body {font-family:&#34; Garamond,Arial,Verdana;字体大小:12磅;}
你错过了#34;在上面一行试试这个
body {font-family:&#34; Garamond,Arial,Verdana&#34 ;;字体大小:12磅;}
删除评论