CSS在JSP中不起作用 [英] CSS not working in JSP
问题描述
我只是想将一些简单的CSS添加到我的JSP页面中。我的jsp页面位于以下目录中; WebContent> WEB-INF> pages> Login.jsp |我的css文件位于这里; WebContent> WEB-INF> css> Login.css
I am just trying to add some simple css to my JSP page. My jsp page is located in the following directory; WebContent > WEB-INF>pages>Login.jsp | My css file is located here; WebContent > WEB-INF > css > Login.css
这是我的JSP代码。
This is my JSP code.
<head>
<link rel="stylesheet" type="text/css" href="../css/Login.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>
</head>
<body>
<div>
<form method="post">
<table>
<tr>
<td>
//some code
</td>
</tr>
<tr>
<td>
//some code
</td>
</tr>
<tr>
<td>
//some code
</td>
</tr>
</table>
</form>
</div>
</body>
,这是我的CSS
table {
border-width: 1px;
border-color: black;
border-style: solid;
}
我只是想在桌子周围进行边框显示,看它是否会工作,而不是。我的桌子周围没有任何边界。
I just wanted to make a border show around the table to see if it would work and it's not. There is no border around my table what so ever.
任何想法为什么这可能不工作
Any idea why this may not be working
推荐答案
可能问题是你的css文件的路径。首先,尝试从 WEB-INF
目录中删除页面和css文件夹,并将它们放在 WEB-INF
。然后试试这个:
Probably the problem is path to your css file. First, try to remove your pages and css folder from your WEB-INF
directory and put them next to WEB-INF
. Then try this instead:
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/Login.css" />
这篇关于CSS在JSP中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!