I don't know why external CSS file doesn't apply to the html file.
I'm now programming on the Cloud IDE(goormIDE - it's similar to C9). I wanted to link external CSS File to the HTML File on the web server using node.js. But it doesn't apply to the HTML. I researched a lot, but can't solve the problem.
It has 3 main file (index.html, style.css, main.js) And They are in same folder.
index.html
<!doctype html>
<html>
<head>
<title>YOONJONG</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css" type="text/css" >
</head>
<body>
<a href="intro.html">INTRO</a>
<a href="portfolio.html">PORTFOLIO</a>
<a href="board.html">BOARD</a>
<a href="contact.html">CONTACT</a>
<p>blahblah</p>
</body>
</html>
style.css
a {
font-size: 36px;
font-weight: 800;
}
p {
font-size: 20px;
}
main.js
var http = require('http');
var fs = require('fs');
var app = http.createServer(function(request,response){
var url = request.url;
if(request.url == '/'){
url = '/index.html';
}
if(request.url == '/favicon.ico'){
response.writeHead(404);
response.end();
return;
}
response.writeHead(200);
response.end(fs.readFileSync(__dirname + url));
});
app.listen(80);
try changing :
<meta charset="utf-8"> <link rel="stylesheet" href="style.css" type="text/css" >
to :
<meta charset="utf-8" /> <link rel="stylesheet" href="style.css" type="text/css" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.