编辑:我不知道我所做的与我在下面写的不同,但它现在有效。不知道为什么 :-/谢谢你们的帮助 :)
我正在尝试将我的文档链接到一个 css 文件。问题是。
这个有效:
<link rel="stylesheet" type="text/css" href="style.css">
这个剂量:
<link rel="stylesheet" type="text/css" href="css/style.css">
当然,当我尝试链接到它时,该文件存在于子文件夹中。
:)
编辑:
HTML文件
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<table id="menu">
<tr>
<td><a id="button">Home</a></td>
<td><a id="button">Education</a></td>
<td><a id="button">Experience</a></td>
<td><a id="button">Gallery</a></td>
<td><a id="button">Cantact Me</a></td></tr>
</table>
它似乎只在我的 html 编辑器 (Expression Web) 中有效,但当我在浏览器 (chrome/firefox/ie) 中打开它时,它不起作用。
样式文件:
body{ background-color: white;}
#menu { width:100%; background-image:url('BarBG.png'); border:0px; }
#button
{
color:white;
font-size:large;
line-height:45px;
vertical-align:middle;
text-align:center;
display: block;
width: 100px;
height: 45px;
margin-right:auto;
margin-left:auto;
}
#button:hover{
color:black;
font-size:large;
line-height:45px;
vertical-align:middle;
text-align:center;
display: block;
width: 100px;
height: 45px;
margin-right:auto;
margin-left:auto;
background-image:url('BarBGHover2.png');
cursor:pointer;
}
最佳答案
Trey 建立相对于根的链接
<link rel="stylesheet" type="text/css" href="/css/style.css">
关于HTML CSS - 没有文件夹适用于不,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11728753/