1

完整和完全的菜鸟在这里。我的外部样式表在 IE9 中运行良好,但在 Chrome 中根本无法运行。这是HTML。

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<link rel="stylesheet" href="default.css" />
</head>

<title>DCE</title>

</head>

<body>

<a href="index.html">
<img src="Images\logo.png" alt="Logo" width="50%" height="50%">
</a> 

<br>

<hr style="height:5px">
<embed height="50" width="100" src="Theme.mp3">

<ul>ABC
<a href="pages\aboutus.html"><li>Z</li></a> 
<a href="pages\AAAA.html"><li>Y</li></a> 
</ul>

<h2>X</h2>

<p>Blah</p>
<p>Blah</p>


</body>

</html>

还有可怕的CSS。

h1 {color:#e03d89;}
body {background-image:url(Images/Background.png);}
h2 {font-family:Tahoma, Geneva, sans-serif;}
p {font-family:Arial, Helvetica, sans-serif;}
a:link {color:#e03d89;}     
a:visited {color:#e97fa5;}  
a:hover {color:#eb0258;}  
a:active {color:#7a0453;}  
p {margin-left: 30px; text-indent: 20px}
h2 {color:#e03d89;}
h2 {text-align:center}

感谢你们提供的任何帮助。我确定我在发布此内容时做错了可怕的事情,我所能做的就是希望大家能原谅我。

4

2 回答 2

2

有几件大事可能会绊倒 Chrome:

您有两个用于 head 的结束标签,第一个导致标题标签位于 head 之外。

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<link rel="stylesheet" href="default.css" />
</head>  <!--  REMOVE THIS CLOSING HEAD!! -->

<title>DCE</title>

</head>

在您的 UL 和 LI 标签中,您不能在 li 标签之外包含文本或元素,您的锚标签“a”和文本 ABC 需要更改。

    <ul>ABC <!-- REMOVE ABC -->
    <a href="pages\aboutus.html"><li>Z</li></a> <!-- anchor tags outside of the li tag -->
    <li><a href="pages\AAAA.html">Y</a></li> <!-- anchor tags INSIDE of li tag - this is the way to do it -->
</ul>

Like @cimmanon said, the slashes in your html links are back slashes and they should be forward slashes "pages/AAAA.html" instead of "pages\AAAA.html".

Those three changes will probably get your style sheet back up and running. I can tell you're learning/experimenting so I won't go overboard correcting the rest, keep learning and you'll get there :)

于 2013-01-18T03:53:17.250 回答
0

In addition to what Allen said...

1) The is the html start tag, so you don't need the addition 2) Elements that don't have a second closing tag, end with /> like (this applies to embed, br, hr and img. I don't know if that would break anything but it's best to do things right anyway. 3) And put a type="text/css" in the stylesheet link tag.

于 2013-01-18T04:06:17.277 回答