Saturday 20 February 2016

Issues with CSS not applying

Very new to Node JS, HTML, and JavaScript. Any corrections and help will be appreciated.Currently I have a node file that requires my html file and hosts it. Within that html file it has a link to my css stylesheet. However, it does not use the css file. When inspecting the page it sees the css file but does nothing with it. If I save both files in my text editor and drag that to the browser it uses the css file without issue.I have exhausted myself trying suggestions from google searches and searches on reddit. Help me reddit, you are my only hope!**Directory Tree** /root |_ nodejs |_ uiTesting |_ main.js main.html style.css **main.js** var http = require('http'), fs = require('fs'); http.createServer(function (request, response) { fs.readFile("main.html", 'utf-8', function (err, html) { response.writeHead(200, {'Content-Type': 'text/html'}); response.write(html); response.end() }); }).listen(80); **main.html**

This is just a test

**style.css** p { font-size: 40px } Also, any suggestions on how to properly create a directory tree for node.js or webpage creation in general would be helpful.

Submitted February 21, 2016 at 01:42AM by jarscohar

No comments:

Post a Comment