我得承认这对我来说是一个初学者错误。我从没见过...
我有这段代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang; ?>" >
<head>
<title><?php echo PAGE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" media="all" type="text/css" title="General" href="./res/css/general.css" />
<link rel="stylesheet" media="all" type="text/css" title="Popup" href="./res/css/popup.css" />
<link rel="stylesheet" media="all" type="text/css" title="test" href="./res/css/test.css" />
</head>
<body>
Hello !
...
absolutely no problem here !!!
...
</body>
<html>
我相信它没有错,只是必须有。当我测试页面时,所有 HTML 都显示出来,但没有合适的样式。事实上,只有第一个样式表对样式有任何影响。 我尝试将第一个文件代码(工作)放入其他文件之一,但它不再工作了。
我尝试使用谷歌搜索,但找不到任何东西(也许我也没有搜索好)...我也尝试了不同的路径,但它适用于第一个,为什么其他路径不行。我尝试重命名文件。我还专门为此创建了第三个,希望我只是把名字弄错了。
过去一个小时一直困扰着我...所以,我相信我需要一些帮助...
提前致谢!
来自法国的问候 ;)
最佳答案
如果你link to an external style sheet并为其设置标题,将其指定为首选样式表:
To make a style sheet preferred, set the rel attribute to "stylesheet" and name the style sheet with the title attribute.
但只使用了第一个首选样式表:
If two or more
LINK
elements specify a preferred style sheet, the first one takes precedence.
关于html - 仅加载第一个 CSS 样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3538579/