【问题标题】:What is the best way to use bootstrap 3 (grid)) in yii 1.1?在 yii 1.1 中使用 bootstrap 3 (grid)) 的最佳方法是什么?
【发布时间】:2017-11-29 13:59:22
【问题描述】:

我想在 yiii 中使用 bootstrap 3(网格)。尤其是 CGridView 和其他 yii 小部件。

我真的很希望能够应用像“.col-sm-4”这样的类。

那么,根据我们目前所知道的,在 yii 1.1(CGridView) 中使用 bootstrap 3(网格)的最佳方式是什么?

谢谢

【问题讨论】:

  • 不要成为仇恨者,但 bootstrap 3 几乎是 EOLYii 1.1 也是如此
  • 如果可能的话,我不介意使用 bootstrap 4 和 yii 1.1。使用一般功能很容易,但我想 CGridView 不会。

标签: php css twitter-bootstrap yii


【解决方案1】:

使用 Boostrap 表类设置 CGridView 小部件的 itemCssClass 属性。

<div class="table-responsive">
<?php
...
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'my-model-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        ...
    ),
    'itemsCssClass' => 'table table-striped table-bordered table-hover table-condensed'
));
...
?>
</div>

.table-responsive 类创建一个响应式表。然后表格将在小型设备上水平滚动(低于 768 像素)。在任何大于 768px 宽的东西上查看时,没有区别

.table 类为表格添加基本样式。

.table-striped 类将斑马条纹添加到表中。

.table-bordered 类在表格和单元格的所有边添加边框。

.table-hover 类在表格行上添加了悬停效果(灰色背景色)。

.table-condensed 类通过将单元格填充减半,使表格更加紧凑。

Boostrap Tables

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    • 2012-09-07
    • 2015-01-13
    • 2020-03-25
    • 2012-05-04
    相关资源
    最近更新 更多