【问题标题】:Spring MVC - CSS not being importedSpring MVC - 未导入 CSS
【发布时间】:2016-11-08 20:54:59
【问题描述】:

所以我尝试了数百种组合,但没有任何帮助。

我有我的 JSP:

about.jsp

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
    <base href="${pageContext.request.contextPath}">
    <link href="resources/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen"/>
    <link href="resources/css/core.css" rel="stylesheet"  media="screen"/>

    <title>foo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>

<body >
<header>
    <jsp:include page="/WEB-INF/view/fragments/header.jsp" />
</header>

<div class="something">
<div class="container" id="alex" >
    <div class="panel panel-default">
        <div class="panel-body">

            <div class="text-center" >
                <h1>Test</h1>

                <p class="lead">
                    bla bla bla
                </p>

            </div>
        </div>
    </div>
</div>
</div>

<footer>
    <jsp:include page="/WEB-INF/view/fragments/footer.jsp" />
</footer>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/resources/js/bootstrap.min.js"></script>
</body>
</html>

我有 bootstrap.min.css,它的应用没有问题,并且在同一个目录中:

core.css

body {
    padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
    padding-bottom: 40px;
    background-color: #6977f5;
}

出于某种原因,这对我的 about.jsp 没有影响,无论其内容如何。

我尝试更改引用,添加 base href,删除 bootstrap.min.css,但无论我做什么,它都无法正常工作。

【问题讨论】:

  • 这很奇怪.. 尝试在 head 标签内的 中添加 core.css 的内容,而不是使用链接,看看是否有帮助..

标签: html css twitter-bootstrap jsp spring-mvc


【解决方案1】:

实际上并没有什么问题,它只是被浏览器缓存,因此没有显示我所做的更改。

【讨论】:

    猜你喜欢
    • 2019-10-30
    • 2017-03-08
    • 1970-01-01
    • 2013-07-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-17
    • 1970-01-01
    相关资源
    最近更新 更多