[英]link css file in another folder doesnt work
im using appserver and i want to link style.css 我正在使用appserver,我想链接style.css
.header {
height: "40px";
background-color: "red"
}
in my index.php 在我的index.php中
<html>
<head>
<META HTTP-EQUIV="Content-language" CONTENT="ar">
<link rel="shortcut icon" href="img/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="CSS/style.css"/>
<title>بام للسيارات | تبضع اينما كنت</title>
</head>
<body>
<div class="header">
</div>
</body>
</html>
but it didnt work i dont know why can someone help me 但它没有用,我不知道为什么有人可以帮助我
Obviously your CSS is incorrect, 显然您的CSS不正确,
.header {
height: "40px";
background-color: "red"
}
Noticing the quotes in your values, which are invalid in CSS syntax. 注意值中的引号 ,这在CSS语法中无效。 It should be,
它应该是,
.header {
height: 40px;
background-color: red;
}
After reviewing your code, there is no other coding errors. 查看代码后,没有其他编码错误。 But your have serious errors with your file encodings.
但是您的文件编码存在严重错误。
index.php was encoded in UTF-16LE, and your didn't declare your charset in the <head>
section nor the BOM (neither does your css file, which is encoded in UTF-8). index.php是用UTF-16LE编码的,您没有在
<head>
部分或BOM中声明字符集(您的css文件也没有以UTF-8编码)。 So the browser guesses the resource files are also encoded in UTF-16LE, which read two bytes as one character. 因此,浏览器猜测资源文件也以UTF-16LE编码,该文件读取两个字节作为一个字符。 So your CSS became totally meaningless to the CSS parser, as it reads
栮慥敤ൻ †栠楥桧㩴㐠瀰㭸††慢正牧畯摮挭汯牯›敲㭤ൽ
. 因此,对于CSS解析器,您的CSS变得完全没有意义,因为它显示为
栮慥敤ൻ †栠楥桧㩴㐠瀰㭸††慢正牧畯摮挭汯牯›敲㭤ൽ
。
So the fix is pretty straight forward, 所以解决方法很简单
charset
declaration at the begining of your <head>
<head>
添加charset
声明 UTF-8
encoding or add charset="utf-8"
to <link>
. UTF-8
编码, 或将charset="utf-8"
到<link>
。 Use this 用这个
<html>
<head>
<META HTTP-EQUIV="Content-language" CONTENT="ar">
<link rel="shortcut icon" href="img/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="CSS/style.css"/>
<title>بام للسيارات | تبضع اينما كنت</title>
</head>
<body>
<div class="header">
</div>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.