4
I went for a style on the page and HTML does not use the CSS file. First I put it like this:
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="bootstrap.css">
And on the console gave this message:
Resource Interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:4000/main.css".
So I put: <link rel="stylesheet" type="text/css" href="main.css">
and kept on giving the same message.
I switched to <link rel="stylesheet" type="text/html" href="bootstrap.css">
and the message stopped from Dart on the console, but my Stylos don’t work, it’s like I haven’t called anything, and the files are in the same index folder.
What can it be?
************ Updates ***********
As you requested, follow server code:
var http = require('http').createServer(server);
var fs = require('fs');
function server(req, response){
response.writeHead(200);
response.end(fs.readFileSync('view/index.html'));
};
http.listen(4000, function(){
console.log("x------------------x");
console.log("x Servidor On-line x");
console.log("x------------------x");
});`
What are you using to serve the files? The problem is in the server configuration that "says" that the style file is CSS and not HTML.
– jsbueno
So, I made a fast server with Node: var http = require('http'). createServer(server); var Fs = require('Fs'); Function server(req, Response){ Response.writeHead(200); Response.end(Fs.readFileSync('view/index.html'); }; http.Listen(4000, Function(){ console.log("x------------------x"); console.log("x Online Server x"); console.log("x------------------x"); });` ...
– Rafaela Cordeiro
@Rafaelacordeiro, it is not the best option to make a server "fast" with the module
http
. You can choose toexpress
orhttp-server
. That being said, follow a "small" code to resolve your problem. https://stackoverflow.com/a/29046869/9101590– Valdeir Psr
You can post your css file please if it’s not too big.
– Bruno Romualdo
The problem then is clearly on the server you created. Use a development-ready server - or post your server code so it can be fixed: that’s where your specific problem is. (you can use the python language installed on your system to serve static files directly:
python3 -m http.server 4000
)– jsbueno