如何修复前两列和Bootstrap RWD表的Header

时间:2017-09-25 08:56:27

标签: html css twitter-bootstrap

我有一个引导表。我可以在水平滚动的同时冻结第二列。

我的代码:



override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews();
    // On small screens, columnify the layout
    let mainContent = view.viewWithTag(1) as! UIStackView; //contains large image and text
    let thumbnails = view.viewWithTag(3) as! UIStackView; //three images
    mainContent.axis = .horizontal
    mainContent.distribution = .fillProportionally
    thumbnails.axis = .horizontal
    if(self.view.bounds.width < 1000) {
        mainContent.axis = .vertical
        mainContent.distribution = .equalSpacing
       thumbnails.axis = .vertical
    } else {
        mainContent.axis = .horizontal
        mainContent.distribution = .fillProportionally
       thumbnails.axis = .horizontal
    }
}
&#13;
.table>thead:first-child>tr:first-child>th:nth-child(2) {
  position: absolute;
  display: inline-block;
  background-color: #D4D4D4;
  width: 80px;
  /*height: 100%;*/
}

.table>tbody>tr>td:nth-child(2) {
  position: absolute;
  display: inline-block;
  background-color: #D4D4D4;
  width: 80px;
  /*height: 100%;*/
}

.table>thead:first-child>tr:first-child>th:nth-child(3) {
  padding-left: 100px;
}

.table>tbody>tr>td:nth-child(3) {
  padding-left: 100px !important;
}
&#13;
&#13;
&#13;

这是我的Fiddle

如果我想在滚动时冻结前两列(#和Firstname)和表头。我怎么修改?谢谢!

1 个答案:

答案 0 :(得分:2)

你可以用同样的方式做,只需添加缩进:

minAccessRole