简体   繁体   中英

Inline CSS styles in JSP

I am trying to render THIS in JSP. I want the styling to be inline right now as I am in the early stages of development .

My JSP code is

<%
%><%@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.

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. You need to import a css file into the jsp using jstl core tags. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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