水平滚动 - Div - 页面内容css类

时间:2016-03-02 07:18:36

标签: html css scroll responsive-design

enter image description here如何显示页面特定部分的主水平滚动条?

我有一个这样的div

<div class="main-content" ng-controller="something" id="something">
    <div class="breadcrumbs" id="breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <a href="#"> <i class="fa fa-home home-icon"></i></a>
                <a href="#">Home</a>
                <span class="divider">
            <i class="icon-angle-right arrow-icon"></i>
            </span>
            </li>
            <li>Customer</li>
            <li class="Active">List Customer

            </li>
        </ul>
    </div>
    <div class="page-content">
        <div class="page-header position-relative">
            <h1>
           something
            <small>
            <i class="icon-double-angle-right"></i>
           something
            </small>
         </h1>
        </div>
        <!--/.page-header-->
        <div class="row">
            <div class="col-xs-12">
                <table id="simple-table" class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th colspan="4" class="ui-state-default">Search</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td width="25%"> something </td>
                            <td width="25%">
                                <div class="form-group" style="margin: 0px">
                                    <div class="clearfix">
                                        <select name="something" id="somethingn" class="selectcls col-xs-12 col-sm-12" chosen allow-single-deselect="true" data-placeholder="Choose Your Manager" no-results-text="'Tough luck'" ng-model="frmData.bmanagermodel" ng-options="something" ng-change="something()">
                                            <option value="">ALL</option>
                                        </select>
                                    </div>
                                </div>
                            </td>
                            <td width="25%">something </td>
                            <td width="25%">
                                <div class="form-group" style="margin: 0px">
                                    <div class="clearfix">

                                        <input class="form-control" id="something" type="text" placeholder="User Name" ng-model="somethingsomethingsomethingsomethingsomethingsomething">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="25%">somethingsomethingsomethingsomethingsomething</td>
                            <td width="25%">
                                <div class="input-group col-xs-12 col-sm-12">
                                    <select name="status" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">ALL</option>
                                        <option value="Online">Online</option>
                                        <option value="Active">Active</option>
                                        <option value="Expired">Expired</option>
                                        <option value="Disabled">Disabled</option>
                                        <option value="Hold">Hold</option>
                                    </select>
                                </div>
                            </td>
                            <td width="25%"> somethingsomethingsomethingsomethingsomething </td>
                            <td width="25%">
                                <div class="form-group" style="margin: 0px">
                                    <select name="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="selectcls col-xs-12 col-sm-12" chosen data-placeholder="Choose Package" no-results-text="'Tough luck'" ng-model="somethingsomethingsomethingsomethingsomething" ng-options="somethingsomethingsomethingsomethingsomething" ng-change="somethingsomethingsomethingsomethingsomething()">
                                        <option value="">ALL</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="25%"> somethingsomethingsomethingsomethingsomething</td>
                            <td width="25%">
                                <div class="input-group col-xs-12 col-sm-12">
                                    <input class="form-control date-picker" id="st_date" type="text" data-date-format="dd-mm-yyyy" placeholder="From Date" ng-model="somethingsomethingsomethingsomethingsomething">
                                    <span class="input-group-addon">
                                     <i class="fa fa-calendar bigger-110"></i>
                                 </span>
                                </div>
                            </td>
                            <td width="25%">somethingsomethingsomethingsomethingsomething</td>
                            <td width="25%">
                                <div class="input-group col-xs-12 col-sm-12">
                                    <input class="form-control date-picker" id="end_date" type="text" data-date-format="dd-mm-yyyy" placeholder="To Date" ng-model="somethingsomethingsomethingsomethingsomething">
                                    <span class="input-group-addon">
                                   <i class="fa fa-calendar bigger-110"></i>
                                </span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="25%"> somethingsomethingsomethingsomethingsomething</td>
                            <td width="25%">
                                <div class="input-group col-xs-12 col-sm-12">
                                    <select name="acctype" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="0" selected>somethingsomethingsomethingsomethingsomething</option>
                                        <option value="1">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="2">somethingsomethingsomethingsomethingsomething</option>
                                    </select>
                                </div>
                            </td>
                            <td width="25%">somethingsomethingsomethingsomethingsomething</td>
                            <td width="25%">
                                <div class="input-group col-xs-12 col-sm-12">
                                    <select name="somethingsomethingsomethingsomethingsomething" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="0">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="1">somethingsomethingsomethingsomethingsomething</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr class="ui-state-default">
                            <td colspan="4" align="center">
                                    <input type="button" value="Search" class="btn btn-sm btn-primary" ng-click="somethingsomethingsomethingsomethingsomething()">

                            </td>
                        </tr>
                    </tbody>
                </table>
                <!-- PAGE CONTENT BEGINS -->
                <div class="box">
                    <div class="clearfix">
                        <div style="width:90%;" class="pull-right tableTools-container">
                            <div class="box-tools">
                                <div class="input-group pull-right" style="width: 20%;height:33px;">
                                    <input type="text" name="table_search"  ng-model="searchText" class="form-control input-sm pull-right" style="width: 150px;height: 33px;" placeholder="Search">
                                    <div class="input-group-btn">
                                        <button class="btn btn-sm btn-info "><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                                <div class="input-group pull-right" ng-show="somethingsomethingsomethingsomething != 'null' && somethingsomethingsomethingsomething.length != 0" style="width: 55%">

                                    <a style="padding:5px;float:right;" ng-mousedown='somethingsomethingsomethingsomething()' href="javascript:void(0)"><i class="fa fa-search-plus fa-2x "  data-toggle="tooltip" tooltip="Advance Search"  tooltip-placement="top"></i></a>
                                    <a style="padding:5px;float:right;" ng-csv="getArray" lazy-load="true" filename="somethingsomethingsomethingsomething.csv" csv-header="getHeader()" data-toggle="tooltip" tooltip-placement="top"><i tooltip='CSV' class="fa fa-file-excel-o fa-2x"></i></a>
                                    <a ng-show="permission.somethingsomethingsomethingsomething" style="padding:5px;float:right;" ng-mousedown='somethingsomethingsomethingsomething()' href="javascript:void(0)"><i class="fa fa-trash fa-2x red"  data-toggle="tooltip" tooltip="Delete"  tooltip-placement="top"></i></a>

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

                    <div class="table-header">
                        somethingsomethingsomething
                        <div class="banner-div">
                           somethingsomethingsomething{{somethingsomethingsomething.length}}
                        </div>
                    </div>
                    <div class="box-body  table-responsive no-padding">
                        <table class="table table-striped table-bordered table-hoversomething" id="somethingsomething" ng-table="tableParams" export-csv="csv">
                            <tr ng-repeat="list in somethingsomething | filter:searchText">
                                <td width="30" style="text-align: left" header="'custChkbx'" class="no-export">
                                    <label>
                                        <input type="checkbox" class="ace" name="somethingsomething[]" value="{{somethingsomething}}" ng-model="somethingsomething" />
                                        <span class="lbl"></span>
                                    </label>
                                </td>
                                <td data-title="'Action'">
                                    <div class=" action-buttons">
                                        <div class="inline pos-abs">
                                            <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">
                                                <i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
                                            </button>
                                            <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-top dropdown-caret dropdown-close">
                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="Edit" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="/dashboard#/something?id={{list.something}}&{{invisibleMenu.something}}">
                                                        <span class="green">
                                     <i id="editRowBtn{{list.id}}" ng-click="setEditId(list.id)" class="ace-icon fa fa-pencil-square-o bigger-120"></i>
                                     </span>
                                                    </a>
                                                </li>
                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="something something" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="/dashboard#/something?something={{list.uname}}&{{invisibleMenu.something}}">
                                                        <span class="green">
                                    <i id="editRowBtn{{list.id}}" ng-click="setEditId(list.id)" class="ace-icon fa fa-refresh bigger-120"></i>
                                    </span>
                                                    </a>
                                                </li>
                                                <li data-toggle="tooltip" tooltip="Customer Details" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="/dashboard#/custdetails/{{list.something}}?{{invisibleMenu.something}}" class="tooltip-error">
                                                        <span class="red">
                                    <i class="ace-icon fa fa-bars bigger-120" id="deleteRowBtn{{list.id}}" ng-click="setDeleteId(list.id)"></i>
                                    </span>
                                                    </a>
                                                </li>
                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="Mac Management" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="/dashboard#/something/{{list.uname}}?{{invisibleMenu.something}}">
                                                        <span class="green">
                                    <i id="editRowBtn{{list.id}}" ng-click="setEditId(list.id)" class="ace-icon fa fa-plus-square bigger-120"></i>
                                    </span>
                                                    </a>
                                                </li>

                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="Add Extra Data Limit" tooltip-placement="right" ng-show="permission.cusda" ng-hide="(list.something != 0 && list.something != 0 && list.something != 0)|| list.something == 0 && (list.something == 0 && list.something == 0 && list.something == 0)">

                                                    <a href="/dashboard#/something/{{list.something}}?{{invisibleMenu.something}}">
                                                        <span class="green">
                                    <i id="editRowBtn{{list.id}}" ng-click="setEditId(list.id)" class="ace-icon fa fa-pencil bigger-120"></i>
                                    </span>
                                                    </a>
                                                </li>
                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="Add Complaint" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="/dashboard#/addcomplaint?something={{list.something}}&{{invisibleMenu.something}}">
                                                        <span class="green">
                                    <i id="editRowBtn{{list.id}}" ng-click="setEditId(list.id)" class="ace-icon fa fa-plus bigger-120"></i>
                                    </span>
                                                    </a>
                                                </li>
                                                <li class="tooltip-success" data-toggle="tooltip" tooltip="Disconnect" tooltip-placement="right" ng-show="permission.something">
                                                    <a href="javascript:void(0)">
                                                        <span class="green">
                                    <i  ng-click="openDisconnect(list.something)" id="editRowBtn{{something.something}}" class="ace-icon fa fa-times bigger-120"></i>
                                    </span>
                                                    </a>

                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </td>

                                <td ng-class="{'something-something': something.something !=something}" data-title="'something something'" sortable="'something'"><span><a ng-if="permission.something" href="/dashboard#/custdetails/{{list.something}}?{{invisibleMenu.custdetails}}" > {{list.uname}}</a><a ng-if="!permission.something" href="javascript:void(0)" > {{list.uname}}</a></span></td>
                                <td ng-class="{'something': something.something == 1 }" data-title="'Name'" sortable="'something'">{{list.firstname}}</td>
                                <td data-title="'something something'" sortable="'company_name'"> {{list.company_name}}</td>

                                <td data-title="'something'" sortable="'something'">{{something}} </td>

                                <td data-title="'something'" sortable="'something'">{{list.ip}}</td>
                                <td data-title="'something something'" sortable="'something'">{{something.something}}</td>
                                <td data-title="'something something'" sortable="'something'">{{something.something |date:'dd-MM-yyyy'}} </td>
                                <td data-title="'something something'" sortable="'something'">{{something.something}}</td>
                                <td data-title="'something something something'" sortable="'something'">{{something.something}}</td>
                                <td data-title="'something something'" sortable="'something'">{{something(something.something)}}</td>
                                <td data-title="'something something'" sortable="'something'">{{something(something.something)}}</tdsomething                               
                                <td data-title="'something'" sortable="'something'">{{something(something.something - something.something)}}</td>
                                <td data-title="'something something'" sortable="'something'">{{list.something}}</td>
                            </tr>
                        </table>
                        <div class="inner" style="text-align:center;" ng-hide="custList!='null' && custList.length!=0">
                            <h4>No Data Available </h4>
                        </div>
                    </div>

                </div>
                <!-- /.box -->
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /.page-content -->
    </div>
</div>

问题:

如果我想查看表格的其他列,我每次都要向下滚动...... !!

现在,我只想在页面底部的页面内容中使用主水平滚动条,因为我有更多的列显示。

***注意:左侧有一个响应式菜单作为部分

帮助将非常感激。

3 个答案:

答案 0 :(得分:0)

设置此元素的高度,并在CSS add属性中设置:

overflow: scroll;

http://www.w3schools.com/cssref/pr_pos_overflow.asp

答案 1 :(得分:0)

使用css滚动条

overflow:scroll;
overflow-x:scroll;

答案 2 :(得分:0)

使用您提供的代码重新创建布局非常困难,但就您所附的图片所描述的那样,您可以获得如下布局:

<强> HTML

<div id="wrapper">
    <div id="left-nav">
        <ul>
          <li>Item</li>
          <li>Item</li>
          <li>Item</li>
          <li>Item</li>
        </ul>
    </div>
    <div id="container">
        <p>Container with some data.</p>
        <p>Container with some data.</p>
        <p>Container with some data.</p>
        <p>Container with some data.</p>
        <p>Container with some data.</p>
        <p>Container with some data.</p>

        <div id="h-content">
            <table border="1">
                <tr>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                    <td>col</td>
                </tr>
            </table>
        </div>
    </div>
</div>

<强> CSS

html,body, #wrapper{
  height: 100%;
}
#left-nav{
  width: 20%;
  float: left;
}
#container{
  width:80%;
  float: left;
}
#h-content{
 width: 95%;
 overflow-x: scroll;
 height: 200px;
}

Demo with Borders