2016-03-03 33 views
-1

我正在按照教程嘗試創建管理面板,但我在某個時候被卡住了。我正在努力使navabar +文本達到最大程度,但它們有點「包裝內容」。Rails - HTML頁面不會佔用全部高度

這是我的html:

<!DOCTYPE html> 
<html> 
<head> 
    <title>TEAM 21 </title> 
    <%= stylesheet_link_tag 'adminpanel', media: 'all', 'data-turbolinks-track' => true %> 
    <!-- <%= javascript_include_tag 'adminpanel', 'data-turbolinks-track' => true %> --> 
    <%= csrf_meta_tags %> 
</head> 
<body> 
    <%if flash[:notice] %> 
    <div class="notice"><%= flash[:notice] %></div> 
    <% end %> 

    <%if flash[:alert] %> 
    <div class="alert"><%= flash[:alert] %></div> 
    <% end %> 

    <!-- HEADER 
    ================================================== --> 
    <div class="containter-fluid display-table"> 
     <div class="row display-table-row"> 
      <!-- Side menu --> 
      <div class="col-md-2 display-table-cell valign-top" id="side-menu"> 
      <h1> Navigation </h1> 

      </div> 

      <!-- Main content area --> 
      <div class="col-md-10 box display-table-cell valign-top"> 

      <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
       Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with 
       the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
      </p> 

      <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
       Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with 
       the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. 
      </p> 
      </div> 
     </div> 
    </div> 

    <!-- CONTENT 
    ================================================== --> 
    <div class="buffer-top"> 
     <!-- <%= yield %> --> 
    </div> 


    <!-- Bootstrap core JavaScript 
    ================================================== --> 
    <!-- Placed at the end of the document so the pages load faster --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> 

</body> 
</html> 

這是我的CSS:

@import "bootstrap-sprockets" 
@import "bootstrap" 


html body 
    font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif 
    background-color: #f3f3f4 
    color: #676a6c 
    height: 100% 



.box 
    border: 1px red dotted 


#side-menu 
    background-color: #2f4050 
    padding: 0px 

#side-menu h1 
    color: #1f3647 
    text-align: center 
    margin: 10px 0px 
    font-size: 25px 

.display-table 
    display: table 
    padding: 0px 
    height: 100% 

.display-table-row 
    display: table-row 
    height: 100% 

.display-table-cell 
    display: table-cell 
    height: 100% 
    float: none 

.valign-top 
    vertical-align: top 

編輯:我忘了提。我嘗試了所有我能找到的解決方案,但它不會全力以赴。

回答

0

這不是css。我認爲這是個問題?檢查身體邊緣。通常是10px。否則使您的HTML到身高100%

html 
    height: 100% 
+0

是的,如果我分開他們它的工作。 –

+0

當'body'爲'100%'且'html'爲'0px'高時,body就是'0px'的100%',因此仍然是'0px'。所以通常記得設置html的高度以及:) –

+0

我有他們那樣,但他們在同一行 –

相關問題