我似乎無法鏈接到我的HTML文件。下面是我的HTML文件:無法鏈接到HTML中的CSS文件
<!DOCTYPE html>
<html>
<head>
<title>Welcome.</title>
<style>
<link href="main.css" rel="stylesheet" type="text/css" />
</style>
</head>
<body>
<p> This paragraph has no ID</p>
<div id="block">
<h2>Hello this is h2 text.</h2>
</div>
<h3> This is a h3 tag with an id that should give it some styling</h3>
<p id="examplep"> This is an example paragraph has an ID that should give it large font.</p>
</body>
</html>
這裏是main.css的,它位於同一文件夾我的HTML文件:
body{
background-color: blue;
}
p{
font-size: 50;
}
#block{
position: absolute;
top: 50%;
left: 50%;
margin-top: -150px;
margin-left: -150px;
color: black;
background-color: white;
width: 300px;
height: 300px;
font-family: Arial, Helvetica, sans-serif;
}
#examplep{
font-size: 50px;
}
對不起蹩腳的格式。無論如何,我相信這是一個連接問題。不應該背景爲藍色,沒有ID的段落大小爲50,div是在頁面中間的白色框,帶白色文本,而examplep段落大小爲50?我已經嘗試瞭解我所知道的一切,但我似乎無法做到。任何幫助?
如果不像上面那樣工作,可以通過輸入該css的完整路徑進行鏈接。 – 2014-08-28 05:13:35