html - Bootstrap 表位置调整

标签 html css twitter-bootstrap html-table

我已经设法将表格的宽度和边距位置设置为 margin-left:-240px;我应该在调整窗口大小时将表格设置为 bootstrap 格式。但是,当我调整窗口大小时,表格位置似乎有点偏离它的位置。如何在不影响 bootstrap 格式的情况下将表格设置为 margin-left?

<div class="container">
        <div class="row">
            <div class="panel panel-primary filterable">
                <div class="panel-heading">
                    <h3 class="panel-title">Hi there</h3>
                </div>
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                            <tr class="filters">
                                    <th class="col-md-2"><input type="text" class="form-control" placeholder="Type" disabled></th>
                                    <th class="col-md-2"><input type="text" class="form-control" placeholder="Course" disabled></th>
                                    <th class="col-md-2"><input type="text" class="form-control" placeholder="Description" disabled></th>
                                    <th class="col-md-1"><input type="text" class="form-control" placeholder="Credit" disabled></th>
                                    <th class="col-md-2"><input type="text" class="form-control" placeholder="Hourly" disabled></th>
                                    <th class="col-md-2"><input type="text" class="form-control" placeholder="Profile" disabled></th>
                                    <th class="col-md-3"><input type="text" class="form-control" placeholder="Book" disabled></th>
                                </tr>
                        </thead>
                        <tbody>
                            <tr class="text-nowrap">
                                <td>3/8/2015</td>
                                <td>1:15 PM</td>
                                <td>Field 7</td>
                                <td>Commingles</td>
                                <td>Jello Shot Jockeys</td>   
                                <td>Jello Shot Jockeys</td>
                                <td>Jello Shot Jockeys</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

mystyle.css

.filterable {
    margin-top: 30px;
    width:140%;
    margin-left:-240px;
}
.filterable .panel-heading .pull-right {
    margin-top: -90px;
}
.filterable .filters input[disabled] {
    background-color: transparent;
    border: none;
    cursor: auto;
    box-shadow: none;
    padding: 0;
    height: auto;
}
.filterable .filters input[disabled]::-webkit-input-placeholder {
    color: black;
}
.filterable .filters input[disabled]::-moz-placeholder {
    color: black;
}
.filterable .filters input[disabled]:-ms-input-placeholder {
    color: black;
}

最佳答案

<div class="container-fluid">
  ---- navbar here ----
  <div class="row" style="top:100px">

    <!-- ----------- left margin ----------------- -->  
    <div class="col-md-2"></div>

    <div class="col-md-10">
       --- Your table here ---
    </div>

    <!-- ----------- right margin ---------------- -->  
    <div class="col-md-2"></div>
  </div>
</div>

关于html - Bootstrap 表位置调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38171667/

相关文章:

javascript - Materialize CSS 无法以编程方式打开可折叠元素

javascript - 如何使用jQuery在 Bootstrap 中动态设置弹出偏移

twitter-bootstrap - 将 Bootstrap 的工具提示对齐到元素的左侧?

javascript - CSS @Media 无法正常工作

html - 可以在运行时添加到无序列表

html - 六边形的CSS3动画气泡效果

html - 同时定位一个 id 和一个类

javascript - 如何避免使用 react 在/页面中执行主脚本?

javascript - 使用 Angular bootstrap 的 TYPEAHEAD 插件和 ng-change 获取选定的值

javascript - 我可以更改 IE 中禁用的 HTML 选择元素的颜色吗?