HTML do not load CSS file

Viewed 28

I started to develop a web page project with nodejs ejs engine. It’s my git repo link: https://github.com/FikretAKBAS/teknikhane.git The problem is when I start my project “npm start” html pages are loading but css file does not load. I tried many different things to figure out that but I didn’t get any solutions for that. In addition to I guess that’s a file path problem. I hope someone could help to solve this problem. Thanks a lot. enter image description here

1 Answers

Remove /public from your css files path
for example
before

  <!-- Additional CSS Files -->
  <link rel="stylesheet" href="/public/css/fontawesome.css">
  <link rel="stylesheet" href="/public/css/templatemo-edu-meeting.css">
  <link rel="stylesheet" href="/public/css/owl.css">
  <link rel="stylesheet" href="/public/css/lightbox.css">

after

  <!-- Additional CSS Files -->
  <link rel="stylesheet" href="/css/fontawesome.css">
  <link rel="stylesheet" href="/css/templatemo-edu-meeting.css">
  <link rel="stylesheet" href="/css/owl.css">
  <link rel="stylesheet" href="/css/lightbox.css">

After you started the server
Your public folder become a root folder for localhost:5000

Related