【发布时间】:2021-05-07 20:29:52
【问题描述】:
我一直在作为一个初学者 Web 开发项目从事投资组合,但是,我在链接我的 CSS 时遇到了问题。
该页面按照 GitHub 页面上的说明显示,但是当在任何浏览器上本地运行时,无论是否清空缓存,它都不会显示。
这是 HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<meta name=“viewport” content=“width=device-width, initial-scale=1.0”>
<meta http-equiv=“X-UA-Compatible” content=“ie=edge”>
<link href='styles.css' rel='stylesheet' type='text/css' />
<title>Mohsen Bakhit</title>
<script src="script.js" ></script>
</head>
<body>
<div class='header'>
<h1>Mohsen Bakhit</h1>
<h2>Developer For Hire</h2>
</div>
</body>
</html>
还有 CSS 文件:
html {
font-family: 'Montserrat', 'Open Sans', monospace;
font-size: 16px;
}
.header {
position: relative;
text-align: center;
color: black;
background-image: url('/resources/vancouver.jpg');
}
.header h1{
color: white;
font-size: 2rem;
position: absolute;
top: 50%;
bottom: 50%;
transform: translate(-50%, -50%);
}
.header h2{
font-size: 1.25rem;
color: white;
position: absolute;
top: 50%;
bottom: 50%;
transform: translate(-50%, -50%);
}
需要明确的是,没有任何效果出现,甚至字体也没有。 这些文件位于同一个文件夹中,这就是为什么没有链接元素的相对路径。 非常感谢您的帮助。
【问题讨论】:
-
你的脚本工作了吗?
标签: html css bootstrap-4 web-deployment-project