J
J
jNikkoo2022-03-27 17:56:29
css
jNikkoo, 2022-03-27 17:56:29

How to solve the problem when css is not loading?

Good evening gentlemen. Help me please. I am making a servlet project on jsp, maven and tomcat. Before reinstalling Windows, there was a situation that the Edge browser loaded css, but Yandex did not (it suited me, development continued). Now the situation is different and Edge and Firefox do not see css. Error in firefox browser console: Style sheet localhost:8079/jConference_war/style.css was not loaded because its MIME type ("text/html") is not "text/css". Edge didn't throw any error. I asked a bit of the whole code - because the problem remains even with such a small amount of code.

Loading page:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" >
    <link rel="stylesheet" href="style.css" type="text/css">
    <title>Document</title>
</head>
<body class="bds1">
    <p>asdasd</p>
</body>
</html>


css:
.bds1{
    background: black;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2022-03-27
@jNikkoo

The server must return the correct file type for the CSS. Content-Type header.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question