make Gridview column smaller

I have a gridview like this





<?= GridView::widget([

        'dataProvider' => $dataProvider,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],

            [

                'attribute' => 'st_hourly_payable',

                'format' => 'currency',

                 'contentOptions' => ['style' => 'max-width: 50px']

            ],

            [

                'attribute' => 'ot_hourly_payable',

                'format' => 'currency',

                'contentOptions' => ['style' => 'max-width: 50px']

            ],

            [

                'attribute' => 'dt_hourly_payable',

                'format' => 'currency',

                'contentOptions' => ['style' => 'max-width: 50px']

            ],

            [

                'attribute' => 'st_hourly_billable',

                'format' => 'currency',

                'contentOptions' => ['style' => 'max-width: 50px']

            ],

            [

                'attribute' => 'ot_hourly_billable',

                'format' => 'currency',

                'contentOptions' => ['style' => 'max-width: 50px']

            ],

            [

                'attribute' => 'dt_hourly_billable',

                'format' => 'raw',

                'contentOptions' => ['style' => 'max-width: 50px']

            ],




please see the attached screenshot. I can not make these columns (‘st_hourly_payable’, ‘ot_hourly_payable’ etc…) smaller at all.

try this:




[

	'attribute' => 'st_hourly_payable',

	'format' => 'currency',

	'width' => '50px',

],



This works for kartik gridview, don’t know about default gridview

This is just a matter of used CSS. See this SO http://stackoverflow.com/questions/8465385/how-can-i-set-the-max-width-of-a-table-cell-using-percentages