![](/img/trans.png)
[英]HTML Link to another page does not execute javascript or load CSS
[英]CSS does not link to the HTML page
我嘗試添加媒體,rel 但它不起作用。CSS 文件與 html 文件位於同一目錄中。 我的其他網站的 css 工作,但不幸的是,這沒有。 我正在嘗試外部鏈接(使用鏈接標簽)。 我查看了類似的問題,但沒有解決我的問題。 謝謝您的幫助。
我的文件:
body { background - color: #ffffff; text - decoration - color: #003366; font-family: Arial; } head { background-color: # 003366; text - decoration - color: #AEC3E3; font - family: "Times New Roman"; } h1 { line - height: 200 %; text - indent: 1e m; } nav { font - weight: bold; } dt { text - decoration - color: #5280C5; font-family: "Times New Roman"; }.category { font-weight: bold; text-decoration-color: # 5380 C5; font - family: "Times New Roman"; } footer { font - size: .70e m; font - style: italic; }
<.DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="fishcreek.css" /> <meta charset="UTF-8"> <title>Fish Creek Animal Clinic</title> <h1>Fish Creek Animal Clinic</h1> </head> <body> <nav><a href="home.html">Home</a> <a href="menu.html">Menu</a> <a href="music.html">Music </a><a href="jobs,html">Jobs </a> </nav> <dl> <dt>Full Service Facility</dt> <dd>Doctors and staff are on duty 24 hours a day. 7 days a week,</dd> <dt>Years of Experience</dt> <dd>Fish Creek Veterinarians have provided quality. dependable care for your beloved <br> animals since 1984. </dd> <dt> Open Door Policy </dt> <dd>Our professionals welcome owners to stay with their pets during any <br> medical procedure, </dd> </dl> <p>888-555-5555<br> 1242 Grassy Lane<br> Fish Creek; WI 55534 </p> <footer>Copyright ©. 2018 Fish Creek Animal Clinic <br> <a href="memohacan@gmail.com">memohacan@gmail.com</a> </footer> </body> </html> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Fish Creek Animal Clinic</title>
<h1>Fish Creek Animal Clinic</h1>
<link rel="stylesheet" type="text/css" href="fishcreek.css" />
</head>
<body>
<nav><a href="home.html">Home</a> <a href="menu.html">Menu</a> <a
href="music.html">Music
</a><a href="jobs.html">Jobs </a>
</nav>
<dl>
<dt>Full Service Facility</dt>
<dd>Doctors and staff are on duty 24 hours a day, 7 days a week.</dd>
<dt>Years of Experience</dt>
<dd>Fish Creek Veterinarians have provided quality, dependable care for your beloved <br> animals since 1984. </dd>
<dt> Open Door Policy </dt>
<dd>Our professionals welcome owners to stay with their pets during any <br> medical procedure. </dd>
</dl>
<p>888-555-5555<br> 1242 Grassy Lane<br> Fish Creek, WI 55534
嘗試使用“類型”屬性指定文件類型,如下所示:
<link rel="stylesheet" type="text/css" href="fishcreek.css" />
我之前也遇到過同樣的問題,因為我沒有指定文件類型。
我還注意到在 index.html 的末尾有第二個關閉 HTML 標記。
刪除text-decoration-color
行以避免在某些瀏覽器上出現問題。 在下面的html中,css文件“fishcreek.css”與html鏈接。 為了測試,我添加了一種color: green
到身體;)
索引.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fish Creek Animal Clinic</title>
<link rel="stylesheet" href="fishcreek.css">
</head>
<body>
<h1>Fish Creek Animal Clinic</h1>
<nav>
<a href="home.html">Home</a>
<a href="menu.html">Menu</a>
<a href="music.html">Music</a>
<a href="jobs.html">Jobs</a>
</nav>
<dl>
<dt>Full Service Facility</dt>
<dd>Doctors and staff are on duty 24 hours a day, 7 days a week.</dd>
<dt>Years of Experience</dt>
<dd>Fish Creek Veterinarians have provided quality, dependable care for your beloved
<br>animals since 1984.</dd>
<dt>Open Door Policy</dt>
<dd>Our professionals welcome owners to stay with their pets during any
<br>medical procedure.</dd>
</dl>
<p>888-555-5555
<br>1242 Grassy Lane
<br>Fish Creek, WI 55534</p>
<footer>
Copyright © 2018 Fish Creek Animal Clinic
<br><a href="memohacan@gmail.com">memohacan@gmail.com</a>
</footer>
</body>
</html>
魚溪.css
body {
color: green;
font-family: 'Arial', Helvetica, sans-serif;
}
header {
background-color: #003366;
font-family: 'Times New Roman', Times, serif;
}
h1 {
line-height: 200%;
text-indent: 1em;
}
nav a {
text-decoration: underline;
font-weight: bold;
}
nav a:hover,
nav a:active {
color: red;
}
dt {
font-family: 'Times New Roman', Times, serif;
}
.category {
font-weight: bold;
font-family: 'Times New Roman', Times, serif;
}
footer {
font-size: .70em;
font-style: italic;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.