【发布时间】:2018-05-07 19:03:33
【问题描述】:
我正在开发我的第一个项目,但我遇到了 CSS 问题。 我无法在 jsp 文件中移动值。我已经并且想要将它移动到页面中间,但它不起作用。如果您有不清楚的地方,也对我的英语感到抱歉。我将非常感谢您的帮助。
header.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<title>${title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="/styles/style.css">
footer.jsp
<footer class="footer">
<div class="container">
<p><a href="/"> Test Web-Application </a></p>
<p >© 2018 All rights reserved.</p>
</div>
index.jsp
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="tmp/header.jsp"/>
<div class="container">
<div class="page-header">
<h1 class="title_position">Test project (Overview)</h1>
</div>
<br>
<p class="lead">Test 1: Product <a href="/products">Products</a>and <a href="/users">Users</a>
</p>
<br>
<p class="lead">Test 2: <a href="/users">show Users</a> </p>
<div class="page-header">
<table id="users">
<thead>
<tr>
<th class="disabled-sorting">#</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<c:forEach items="${users}" var="users">
<tr>
<td>${user.id}</td>
<td>${user.username}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
<br>
<p class="lead">Test 3: <a href="/categories>">Show categories</a> </p>
<div class="lead">
<tbody>
<c:forEach items="${categories}" var="category">
<tr>
<td>${category.id}</td>
<td>${category.categoryOfProduct}</td>
</tr>
</c:forEach>
</tbody>
</div>
<br>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">This button do nothing</button>
</div>
</div>
<br>
style.css
html {
position: relative;
min-height: 100%; }
body {
margin-bottom: 60px;}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;}
.custom-container {
width: auto;
max-width: 680px;
padding: 0 15px;}
.custom-container .text-muted {
margin: 20px 0;}
.title_position {
text-align: center;
font-size: xx-large;}
.menu-size{
font-size: 20px;}
.registrationForm{
background: lime;
text-align: center;}
.production_Page{
margin-left: 500px;}
.indexPage{
margin-left: 500px;}
【问题讨论】:
-
不要链接到代码。将相关代码插入问题中,格式正确。
-
欢迎来到 StackOverFlow。请通过how to ask ,提出您的问题Minimal, Complete, Verifiable Example 编码问题,必须可以复制以帮助您。