JSP页面为什么调用外部CSS不成功?
代码:<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%><%Stringpath=request...
代码:
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>远程健康管理系统</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="../css/front-page.css" />
<script type="text/javascript" src="D:\ICBase\jquery-1.6\jquery-1.6.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".ul-2").hide();
$(".li-1").hover(
function(){
$(this).children(".ul-2").fadeIn();
},function(){
$(this).children(".ul-2").hide();
}
);
});
</script>
</head>
<body id="body">
<div id="nav">
<ul class="ul-1">
<li class="li-1"><a href="consult-diagnose.jsp" target="_blank">咨询诊断</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">健康咨询</a></li>
<li class="li-2"><a href="#" target="_blank">专家诊断</a></li>
</ul>
</li>
<li class="li-1"><a href="health-data.jsp" target="_blank">健康数据</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">心电数据</a></li>
<li class="li-2"><a href="#" target="_blank">血压数据</a></li>
<li class="li-2"><a href="#" target="_blank">血氧数据</a></li>
</ul>
</li>
<li class="li-1"><a href="data-collect.jsp" target="_blank">数据采集</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">无线心电仪</a></li>
<li class="li-2"><a href="#" target="_blank">无线血压仪</a></li>
<li class="li-2"><a href="#" target="_blank">无限血氧仪</a></li>
</ul>
</li>
<li class="li-1"><a href="personal-info.jsp" target="_blank">个人信息</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">个人资料</a></li>
<li class="li-2"><a href="#" target="_blank">健康档案</a></li>
<li class="li-2"><a href="#" target="_blank">密码修改</a></li>
</ul>
</li>
<li class="li-1"><a href="front-page.jsp">首 页</a></li>
</ul>
</div>
</body>
</html>
css代码:
#body{font-family: "微软雅黑" ; text-align: center; width: 600px;}
.ul-1 .li-1{border-right: 1px solid white; padding-top: 8px; list-style-type: none; width: 90px; height: 40px;background-color: blue; float: right;}
.ul-2 .li-2{ padding-top: 8px; list-style-type: none; width: 90px; height: 40px; background-color: blue;} 展开
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>远程健康管理系统</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="../css/front-page.css" />
<script type="text/javascript" src="D:\ICBase\jquery-1.6\jquery-1.6.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".ul-2").hide();
$(".li-1").hover(
function(){
$(this).children(".ul-2").fadeIn();
},function(){
$(this).children(".ul-2").hide();
}
);
});
</script>
</head>
<body id="body">
<div id="nav">
<ul class="ul-1">
<li class="li-1"><a href="consult-diagnose.jsp" target="_blank">咨询诊断</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">健康咨询</a></li>
<li class="li-2"><a href="#" target="_blank">专家诊断</a></li>
</ul>
</li>
<li class="li-1"><a href="health-data.jsp" target="_blank">健康数据</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">心电数据</a></li>
<li class="li-2"><a href="#" target="_blank">血压数据</a></li>
<li class="li-2"><a href="#" target="_blank">血氧数据</a></li>
</ul>
</li>
<li class="li-1"><a href="data-collect.jsp" target="_blank">数据采集</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">无线心电仪</a></li>
<li class="li-2"><a href="#" target="_blank">无线血压仪</a></li>
<li class="li-2"><a href="#" target="_blank">无限血氧仪</a></li>
</ul>
</li>
<li class="li-1"><a href="personal-info.jsp" target="_blank">个人信息</a>
<ul class="ul-2">
<li class="li-2"><a href="#" target="_blank">个人资料</a></li>
<li class="li-2"><a href="#" target="_blank">健康档案</a></li>
<li class="li-2"><a href="#" target="_blank">密码修改</a></li>
</ul>
</li>
<li class="li-1"><a href="front-page.jsp">首 页</a></li>
</ul>
</div>
</body>
</html>
css代码:
#body{font-family: "微软雅黑" ; text-align: center; width: 600px;}
.ul-1 .li-1{border-right: 1px solid white; padding-top: 8px; list-style-type: none; width: 90px; height: 40px;background-color: blue; float: right;}
.ul-2 .li-2{ padding-top: 8px; list-style-type: none; width: 90px; height: 40px; background-color: blue;} 展开
4个回答
展开全部
看你css调用路径那,怎么和调用js 的不一样
<link rel="stylesheet" type="text/css" href="../css/front-page.css" />
<script type="text/javascript" src="D:\ICBase\jquery-1.6\jquery-1.6.js"></script>
路径不对吧
<link rel="stylesheet" type="text/css" href="../css/front-page.css" />
<script type="text/javascript" src="D:\ICBase\jquery-1.6\jquery-1.6.js"></script>
路径不对吧
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1.确认调用目录无误
2.查看未登录用户是否有访问css文件的权限,这个应该可以在配置文件中配置。
2.查看未登录用户是否有访问css文件的权限,这个应该可以在配置文件中配置。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
建议你用绝对路径呗 : 以"/"开始
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询