JSP中的内联CSS样式

时间:2014-10-16 00:12:38

标签: css jsp inline-styles

我正在尝试在JSP中呈现THIS。我希望样式能够在我处于开发的早期阶段时内联。

我的JSP代码是

<%
%><%@include file="/libs/foundation/global.jsp"%><%
%><%@page session="false" %><%
%><%

<style type="text/css">
.line {
width:70%;
}
.line:after {
content:'';
position: absolute;
border-style: solid;
border-width: 15px 15px 0;
border-color: #FFFFFF transparent;
display: block;
width: 0;
z-index: 1;
top: 8px;
left: 45%;
}
.line:before {
content:'';
position: absolute;
border-style: solid;
border-width: 15px 15px 0;
border-color: #7F7F7F transparent;
display: block;
width: 0;
z-index: 1;
top: 9px;
left: 45%;
}
</style>
<%@include file="/apps//global.jsp"%>
<hr class="line">
%>

我确信css样式是正确的,因为它在小提琴中正确呈现。

我有办法解决这个问题吗?任何帮助深表感谢。非常感谢。

2 个答案:

答案 0 :(得分:-1)

为每个部分定义css的类并将其包含在使用

答案 1 :(得分:-4)

不,你不能把CSS直接放到JSP中,它不会那样工作。您需要使用jstl核心标记将css文件导入jsp。请参阅此link,了解如何逐步执行此操作,它描述了如何在Spring MVC项目中将jss添加到jsp。