2016-06-09 75 views
0

在我的應用程序中,我有一個default.html片段,它將所有其他片段分開。它被轉錄的波紋管:thymeleaf - 如何修復標題片段重疊的內容和側邊欄菜單?

<!DOCTYPE html> 
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> 

<head th:include="fragments/common :: commonFragment"> 
<meta charset="UTF-8" /> 
<link rel="shortcut-icon" th:href="@{/assets/img/favicon.png}" type="image/x-icon" /> 
<title th:text="#{app.name}"> </title> 
</head> 
<body> 
    <section th:id="defaultFragment" th:fragment="defaultFragment"> 
     <section id="header" th:replace="fragments/header :: headerFragment"></section> 
     <div id="sidebar-and-content" class="main-container container-fluid"> 
      <div th:replace="fragments/sidebar :: sidebarFragment"></div> 
      <div class="page-container"> 
       <div class="page-content"> 
        <div class="page-body" > 
         <div layout:fragment="content"></div> 
        </div> 
       </div> 
      </div> 
      <section th:replace="fragments/footer :: footerFragment"></section> 
     </div> 
    </section> 
</body> 
</html> 

我注意到的是頭部片段部分重疊了以下部分。如果我註釋掉標題部分,則會在頁面頂部呈現下一個div(id =「sidebar-and-content」)。當我取消註釋(id =「header」)時,下一個div也會呈現在頁面的頂部,並且位於標題下方。

我該如何解決?

回答

0

我設法通過恢復到較早的版本來解決它......

<body> 
    <div th:id="defaultFragment" th:fragment="defaultFragment"> 
     <div th:replace="fragments/header :: headerFragment"></div> 
     <div class="main-container container-fluid"> 
      <div class="page-container"> 
       <div th:replace="fragments/sidebar :: sidebarFragment"></div> 
       <div class="page-content"> 
        <div class="page-body"> 
         <div layout:fragment="content"></div> 
        </div> 
       </div> 
      </div> 
     </div> 
     <div th:replace="fragments/footer :: footerFragment"></div> 
    </div> 
</body> 

一切都很好,工作也應。