'html and css not linking

My html and CSS files are not linking even though they're in the same directory. here's my html code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
    <title>temp</title>

    <link rel="stylesheet" type="text/css" href="main.css">

</head>

I also tried using href="/main.css" and href="./main.css" but to no avail. would appreciate any help!

enter image description here



Solution 1:[1]

Use this app.use(express.static('public')); awesome talking to you guys.

Solution 2:[2]

<link rel='stylesheet' href='./main.css' />

i don't know why it is not working for you. but it should work!!! have you tried restarting your app??

try it. close and then restart.

Solution 3:[3]

Try adding this snippet after title block

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Crystal
Solution 2 sarfaraj shah
Solution 3 Priya