[英]Can't link CSS to HTML in Eclipse Java project
I am building a web project at Eclipse in Java. 我正在用Java在Eclipse上构建一个Web项目。 I wrote a simple HTML and CSS files but I can't see how to link them and I can't spot the problem.
我编写了一个简单的HTML和CSS文件,但看不到如何链接它们,也无法发现问题。
<link rel="stylesheet" type="text/css" href="css/AdminOptionCss.css" >
My files are located here: 我的文件位于这里:
Try to do like this 尝试这样做
<link rel="stylesheet" type="text/css" href="../css/AdminOptionCss.css" >
../ help you to navigate out of html location path , and after go to css and so on
../帮助您导航到html位置路径之外,然后转到CSS等
you have to give a relative path of that css file , it means that : your HTML's are in html
folder , but your CSS's are not in html
folder but your are trying to load them from html
folder! 您必须提供该css文件的相对路径,这意味着:您的HTML位于
html
文件夹中,但是您的CSS不在html
文件夹中,但是您正尝试从html
文件夹中加载它们!
what you need to do is, go a step backward in directory by using ../
and continue pathing, something like this : 您需要做的是,使用
../
在目录中向后退一步,然后继续执行路径,如下所示:
<link rel="stylesheet" href="../css/AdminOptionCss.css" >
将您的Eclipse视图更改为“ Navigator”以查看真实文件路径,并在您的链接标记中使用相对路径,例如href="../css/AdminOptionCss.css"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.