全高,流畅的100%宽度和高度,2列Bootstrap 3布局与标题

时间:2014-10-30 12:36:46

标签: css twitter-bootstrap twitter-bootstrap-3

我正在尝试复制我的客户想要的桌面应用程序布局。我需要帮助div和桌子的最小高度之间的空间。我没有自定义引导程序的经验,所以如果我以错误的方式做到这一点,请分享它应该如何完成。我试图设置一个plunker但我不能让它工作? plunker

 <body  ng-controller="MainCtrl">
  <div class="my-container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
                <div class="container">
                    <ul class="nav navbar-nav pull-left">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Master <span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                <li ng-controller="CustomerCtrl"><a ng-click="CustomerModal()">Customer</a></li>

                            </ul>
                        </li>
                    </ul>
                    <ul class="nav navbar-nav pull-left">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">New <span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                <li ng-controller="JobCtrl"><a ng-click="clearSelectedJob();NewJobModal()">Job</a></li>

                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>
    </div>
    <div class="row clearfix">
        <div class="col-md-2 column well">
            <div class="classWithPad">
                <div class="my-container well classWithPad">
                    <table class="table table-condensed">
                        <span style="background:#595959;display:block;margin-top:-20px;margin-right:-11px;margin-left:-11px;height:95px">ll</span>
                        <thead> <tr><th style="font-weight: bold;padding-top:30px">No</th><th style="font-weight: bold;">Name</th></tr></thead>
                        <tbody>
                            <tr ng-repeat="currentItem in jobArray" class="pointer no_selection" ng-class="{highlight: currentItem.JobNumber===selectedJob.JobNumber}">
                                <td>{{currentItem.JobNumber}}</td>
                                <td>{{currentItem.JobName}}</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-10 column well">
            <div class="classWithPad">
                <ul class="nav nav-tabs">
                    <li ng-class="{active: isActive('/')}"><a ng-href="#/">Home</a></li>
                    <li ng-class="{active: isActive('/changeOrder')}"><a ng-href="#/changeOrder">Change Order</a></li>
                    <li ng-class="{active: isActive('/purchaseOrder')}"><a ng-href="#/purchaseOrder">Purchase Order</a></li>
                </ul>
                <div ng-view=""></div>
            </div>
        </div>

        <div class="col-md-12 column">
            <nav class="navbar navbar-default navbar-fixed-bottom" role="navigation">
                <div class="my-container">

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

这是客户想要的 ClientScreenshot

这是我到目前为止所拥有的 CurrentScreenshot

更新

.my-container {
position: absolute;
top: 0;
bottom: 0;
}

Update

2 个答案:

答案 0 :(得分:6)

在Bootstrap中没有类似的设计模式。我有一些可行的东西。

DEMO:http://jsbin.com/lopej

查看代码:http://jsbin.com/lopej/edit?html,css,js

<强> jQuery的:

$(window).on('load resize', function() {

    var navbarht = $('.navbar').outerHeight();

 function columnHeight() {
     // Column heights should equal the document height minus the header height
     var newHeight = $(document).height() - (navbarht) -20 + "px";
   console.log($(window).height(), (navbarht));
     $(".primary-col").css("height", newHeight);
     $(".secondary-col").css("height", newHeight);
 }

 columnHeight();

 });

<强> CSS:

html,
body {
    background: #777
}
.site-main.row {
    margin: 0
}
.header {
    background: #C5E0DC
}
.primary-col,.secondary-col {
    background-color: #ddd;
    padding:10px;
}
.navbar {
    margin: 0 0 10px 0
}
.inner {
  min-height:100%;
  background:#fff;
  border:1px solid #ccc;
}

/* needed to override jQuery */
@media (max-width:767px) { 
    .primary-col,
    .secondary-col {
        height: auto!important
    }
    .site-main {
        padding-bottom: 0px!important
    }
}

/* larger viewport layout */
@media (min-width:768px) { 
    html,
    body {
        height: 100%;
        width: 100%;
    }
    #page {
        height: 100%;
        height: auto !important;
        min-height: 100%;
    }
    .site-main {
        height: 100%;
        padding:0 10px;
    }
    .secondary-col {
        border-right: 10px solid #777
    }
}

<强> HTML:

  <div id="page">
     <!--  navbar -->
     <div class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="container-fluid">
           <div class="navbar-header">
              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
              <span class="sr-only">Toggle navigation</span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              <span class="icon-bar"></span>
              </button>
              <a class="navbar-brand" href="#">Project name</a>
           </div>
           <div class="navbar-collapse collapse">
              <ul class="nav navbar-nav">
                 <li class="active"><a href="#">Home</a></li>
                 <li><a href="#about">About</a></li>
                 <li><a href="#contact">Contact</a></li>
                 <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                       <li><a href="#">Action</a></li>
                       <li><a href="#">Another action</a></li>
                       <li><a href="#">Something else here</a></li>
                       <li class="divider"></li>
                       <li class="dropdown-header">Nav header</li>
                       <li><a href="#">Separated link</a></li>
                       <li><a href="#">One more separated link</a></li>
                    </ul>
                 </li>
              </ul>
              <ul class="nav navbar-nav navbar-right">
                 <li><a href="../navbar/">Default</a></li>
                 <li><a href="../navbar-static-top/">Static top</a></li>
              </ul>
           </div>
           <!--/.nav-collapse -->
        </div>
     </div>
     <div class="row site-main">
        <div class="col-sm-3 secondary-col">
          <div class="inner">secondary</div>
        </div>
        <!-- /.col-sm-3 -->  
        <div class="col-sm-9 primary-col">
          <div class="inner">primary</div>
        </div>
        <!-- /.col-sm-9 -->  
     </div>
     <!-- /.row -->
  </div>
  <!-- /#page-->

答案 1 :(得分:0)

就高度问题而言,请尝试

.my-container {
    position: absolute;
    top: 0;
    bottom: 0;
}