简体   繁体   English

JSP中的内联CSS样式

[英]Inline CSS styles in JSP

I am trying to render THIS in JSP. 我正在尝试在JSP中呈现此内容 I want the styling to be inline right now as I am in the early stages of development . 我希望现在可以像现在处于开发初期那样将样式设置为内联。

My JSP code is 我的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">
%>

I am certain the css styling is fince as it renders correctly in fiddle. 我确信css样式是正确的,因为它在小提琴中正确呈现。

Is there a way I can fix this? 有办法解决这个问题吗? Any help is much appreciated. 任何帮助深表感谢。 Thanks much. 非常感谢。

为每个部分定义css的类,并将其包括在

No you cannot put CSS directly into the JSP, it doesn't work that way. 不,您不能将CSS直接放到JSP中,那样行不通。 You need to import a css file into the jsp using jstl core tags. 您需要使用jstl核心标签将css文件导入jsp。 Refer to this link on how to do it step by step, it describes how to add css to a jsp in a Spring MVC project. 请参考此链接 ,了解如何逐步执行此链接 ,它描述了如何在Spring MVC项目中将CSS添加到JSP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM