简体   繁体   中英

Linking html file to a css file which is in a subdirectory doesn't work

I have a folder with my loginform.html and a CSS subdirectory with a simple CSS file:

<!DOCTYPE HTML>
<html>
<header>
<title>Login Forms</title>

<link href="CSS/LoginForm_CSS_1.css" rel="stylesheet">

</header>
<body>   
</body>
</html>

The problem is that I cannot link them, and I cannot understand why, I tried:

<link href="CSS/LoginForm_CSS_1.css" rel="stylesheet">

and

<link href="/CSS/LoginForm_CSS_1.css" rel="stylesheet">

and

<link href="../CSS/LoginForm_CSS_1.css" rel="stylesheet">

but nothing works, when I put the LoginForm_CSS_1.css file in the same directory as the html file and use <link href="LoginForm_CSS_1.css" rel="stylesheet"> everything are ok. Any idea what I am doing wrong?

<!DOCTYPE html>
<html>
<head>
    <title></title>
<link href="CSS/LoginForm_CSS_1.css" rel="stylesheet">
</head>
<body>

</body>
</html>

head tag is for root, header tag should be in the body!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM