Yii2, change column width

How to change the column width?

I have found several examples how to chnage the column width, but none of them work for me:

http://www.stackoverflow.dluat.com/questions/30976065/yii2-gridview-cannot-set-column-width

http://www.bsourcecode.com/yiiframework2/gridview-in-yiiframework-2-0/#gridview-options

I tried several ways, but none is working:




// TO SET FIXED WIDTH TO ALL COLUMNS

        <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            [

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

            'contentOptions'=>[ 'style'=>'width: 400px'], 

            ],

          'th',

          'growth_mech',

          'growth_meth',

           'ns', 

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

        ],

    ]); ?>


//There are no style definitions generated in the source

<table class="table table-striped table-bordered"><thead>


// TO SET FIXED WIDTH TO SINGLE COLUMN

        <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            [

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

            ],

          [

             'attribute'=>'th',

             'value'=>'th',

             'contentOptions'=>['style'=>'width: 520px;']

          ],

          'growth_mech',

          'growth_meth',

           'ns', 

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

        ],

    ]); ?>

// There is no style definition generated in the source

<th><a href="/thyii/basic/web/index.php?r=alldata2%2Findex&amp;sort=th" data-sort="th">Th</a></th>