[英]CSS file is not linking to my HTML file
我觉得我只是在忽略一些非常简单的事情。 我无法将排序菜单的CSS文件链接到html文件。相关代码如下。
应该注意的是,CSS文件位于CSS/home/sortmenu.css
。
link
代码:
<head>
<link rel="stylesheet" type="text/css" href="../CSS/all/page.css">
<link rel="stylesheet" type="text/css" href="../CSS/all/header.css">
<link rel="stylesheet" type="text/css" href="../CSS/all/mainmenu.css">
<link rel="stylesheet" type="text/css" href="../CSS/home/table.css">
<link rel="stylesheet" type="text/css" href="../CSS/home/sortmenu.css">
</head>
CSS代码:
/*
#sortmenu {
position: absolute;
background-color: #333;
border: 5px solid #222;
border-top: 0;
margin-left: -5px;
width: 160px;
}
#sortmenu > li {
display: block;
position: relative;
}
#sortmenu li a:hover {
color: #699;
}
#sortmenu li: hover ul {
display: inline-block;
}
.sortsubmenu {
display: none;
position: absolute;
background-color: #333;
border: 5px solid #222;
border-left: 0px;
text-align: right;
top: -5px;
left: 100%;
width: auto;
}
.sortsubmenu li{
display: inline;
white-space: nowrap;
}
.sortsubmenu li a:hover {
color: #DB7093;
}
#songsortmenu {
border-top: 0px;
}
*/
#sortmenu {
background-color: #222;
}
#sortmenu_wrapper {
width: 100%;
margin: 0 auto;
text-align: left;
}
#sortmenu ul {
list-style-type: none;
padding: 0;
margin: 0;
}
删除/
div
之前
<div id="sortmenu">
<div id="sortmenu_wrapper">
<ul>
<li><a href='#'>Name</a></li><li>
<a href='#'>Artist</a></li><li>
<a href='#'>Album</a></li><li>
<a href='#'>Genre</a></li><li>
<a href='#'>Release Date</a></li><li>
<a href='#'>BPM</a></li>
</ul>
</div>
</div>
如果css
文件的路径是CSS/home/sortmenu.css
如下所示。
Project ROOT
|-- currentFile.php
`-- CSS
`-- home
`-- sortmenu.css
那么你应该使用。
<link rel="stylesheet" type="text/css" href="CSS/home/sortmenu.css">
不
<link rel="stylesheet" type="text/css" href="../CSS/home/sortmenu.css">
我认为您的问题出在CSS路径设置中。 签出此页面。 您一定会找到答案的。
https://css-tricks.com/quick-reminder-about-file-paths/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.