为什么溢出在这个HTML代码中不起作用?

时间:2016-04-15 13:21:35

标签: html css twitter-bootstrap-3 overflow

我需要一个左边的固定表,然后我会在固定表的右边添加动态表。

我的HTML代码是:

  • 溢出-x:自动无效

    <div class="col-md-4">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th colspan="2">Fixed Table</th>
                </tr>
                <tr>
                    <th colspan="2">Fixed Table</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>Some Content</td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-md-8">
        <div id="containerForTables" style="overflow-x: auto">
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
    
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
    
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
    
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
    
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
          <div style="display: inline-block;">
            <table class="table table-bordered" data-tablename="SOMEKEY">
                <thead>
                    <tr>
                        <th colspan="3">
                            SOMEKEY
                        </th>
                    </tr>
                    <tr>
                        <th>SOMEKEY 1</th>
                        <th>SOMEKEY 2</th>
                        <th>SOMEKEY 3</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
          </div>
        </div>
    </div>
    

输出: Fixed tables and tables added dynamically

我期待这样的事情(看看水平滚动条):

Expected result

1 个答案:

答案 0 :(得分:0)

使用[响应式网格系统] http://www.responsivegridsystem.com/

以下是9列响应网格的代码

&#13;
&#13;
V
&#13;
def __init__(self, host="localhost", user=None, passwd="",
             db=None, port=3306, unix_socket=None,
&#13;
&#13;
&#13;

当您获得代码时,您必须更改跨度宽度以满足每列的需求,例如。

&#13;
&#13;
/*  SECTIONS  */
.section {
	clear: both;
	padding: 0px;
	margin: 0px;
}

/*  COLUMN SETUP  */
.col {
	display: block;
	float:left;
	margin: 1% 0 1% 1.6%;
}
.col:first-child { margin-left: 0; }

/*  GROUPING  */
.group:before,
.group:after { content:""; display:table; }
.group:after { clear:both;}
.group { zoom:1; /* For IE 6/7 */ }

/*  GRID OF NINE  */
.span_9_of_9 {
	width: 100%;
}

.span_8_of_9 {
  	width: 88.71%;
}

.span_7_of_9 {
  	width: 77.42%;
}

.span_6_of_9 {
  	width: 66.13%;
}

.span_5_of_9 {
  	width: 54.84%;
}

.span_4_of_9 {
  	width: 43.55%;
}

.span_3_of_9 {
  	width: 32.26%;
}

.span_2_of_9 {
  	width: 20.97%;
}

.span_1_of_9 {
  	width: 9.688%;
}

/*  GO FULL WIDTH BELOW 480 PIXELS */
@media only screen and (max-width: 480px) {
	.col {  margin: 1% 0 1% 0%; }
	.span_1_of_9, .span_2_of_9, .span_3_of_9, .span_4_of_9, .span_5_of_9, .span_6_of_9, .span_7_of_9, .span_8_of_9, .span_9_of_9 { width: 100%; }
}
&#13;
&#13;
&#13;