gpt4 book ai didi

html - 外部 CSS 在 Chrome 中不起作用

转载 作者:行者123 更新时间:2023-11-28 13:24:30 25 4
gpt4 key购买 nike

这里是完全的菜鸟。我的外部样式表在 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}

感谢你们提供的任何帮助。我敢肯定我在发布这篇文章时犯了严重的错误,我所能做的就是希望大家能原谅我。

最佳答案

有几件大事可能会导致 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 标签之外的文本或元素,你的 anchor 标签“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>

正如@cimmanon 所说,您的 html 链接中的斜杠是反斜杠,它们应该是正斜杠“pages/AAAA.html”而不是“pages\AAAA.html”。

这三项更改可能会让您的样式表恢复运行。我可以告诉您正在学习/实验,所以我不会过分纠正其余部分,继续学习,您会到达那里:)

关于html - 外部 CSS 在 Chrome 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14391486/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com