[英]External CSS + Google font
由於某種原因,導入的Google字體不起作用? 字體顯示不正確。 這是HTML。
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<link href='https://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
<link href="/main.css" rel=stylesheet type="text/css">
</head>
<body>
<div class="testing">
<h1>nothing to see</h1>
</div>
</body>
</html>
我的CSS文件:
.testing h1 {
font-family: 'Pacifico';
font-style: normal;
}
問題是第二個鏈接標記(包含main.css的那個)的main.css地址錯誤。 嘗試將main.css放在與HTML文件相同的文件夾中,並刪除href值main.css旁邊的斜杠(/),如圖所示
<link href="main.css" rel=stylesheet type="text/css">
如果要將CSS放在單獨的文件中,請插入代碼,如下所示
<link href="(FILE NAME)/main.css" rel=stylesheet type="text/css">
為main.css使用正確的路徑制作css文件夾並將主css文件放入該文件夾並在以下路徑中使用
<link href="css/main.css" rel=stylesheet type="text/css">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.