CSS is not working on any browser on my PC

Asked

Viewed 929 times

-1

Good evening, I have to do a TCC to finish my course, but the CSS of my code does not work in any browser. It only works if I pull it online from the cloud:

<!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.1/js/materialize.min.js"></script>
          

If I pull it offline from my pc, it doesn’t work:

<!DOCTYPE html>
  <html>
    <head>
      <!--Import Google Icon Font-->
      <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <!--Import materialize.css-->
      <link type="text/css" rel="stylesheet" href="css/materialize.min.css"  media="screen,projection"/>

      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    </head>

    <body>
      <!--Import jQuery before materialize.js-->
      <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
      <script type="text/javascript" src="js/materialize.min.js"></script>
    </body>
  </html>

I tried to pull it offline by my school’s pc and it worked, I think it must be something on my pc. If anyone has any idea what it would be, would you help me please?

Obs: it is not the framework as I have tested Uikit as well and it was the same problem.

  • I don’t know but try to use only . css instead of .min.css

  • What is the URL that appears in the browser when you open this html in it?

3 answers

1

Check the permission of the file / folder, maybe you don’t have enough permission.

On linux (Debian, Ubuntu, etc..

Recommended permission for directories (folders) is 755

sudo chmod 755 /nome_da_pasta

Already for files is 644

sudo chmod 644 /nome_do_arquivo

0

It may be that your folder is not giving permission to access. If the address and file name is right.

Do so, right-click your css folder goes into properties and in the security tab click on "Edit"

It will open a new window, click on "Add" type "all" selects the user "All" in the list and gives an OK. In the bottom boxes activates the "Total Control". Gives an ok and closes. Makes a test to see.

  • Thank you, I managed to fix it. It was a problem in typing the code.

  • <link type="text/css" rel="stylesheet" href=".. /css/materialize.min.css" media="screen,projection"/>

  • Oh yes, good that solved, by the way I imagined that was at the root even if had not already given the tip heheh. But good that solved.

0


I managed to solve the problem, I would have to add the 2 points (.) to show that the "css" folder was inside other folders. Sorry guys, it was a simple thing, but I got nervous because of the pressure of TCC kkkkkkk

Here is the answer:

<link type="text/css" rel="stylesheet" href="../css/materialize.min.css"  media="screen,projection"/>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.