title: Yii2 GridView cannot set column width
body: <p>this is the first time I am using the Yii2 GridView Widget. I have tried setting a column's width after reading some answers here on stackoverflow, but it just won't work for me and I would love it if the columns had different widths (especially the first one).</p>
  
  <p>I have tried setting the width using 'contentOptions' directly for the first column and also with an external CSS file for the product name column.</p>
  
  <p>Can someone please tell me if there is an alternative or if there is something I am doing wrong?</p>
  
  <pre><code> &lt;?= GridView::widget([
      'dataProvider' =&gt; $dataProvider,
      'filterModel' =&gt; $searchModel,
      'columns' =&gt; [
          [
              'class' =&gt; 'yii\grid\SerialColumn',
              'contentOptions' =&gt; ['style' =&gt; 'max-width:20px;'],
          ],
  
          [
              'format' =&gt; 'raw', 
              'label' =&gt; 'Image',
              'value' =&gt; function ($data) { 
                  $url = $data-&gt;imgSrc;
                  return Html::img($url, ['width' =&gt; '40px']);
              },
          ],
  
          [
              'attribute' =&gt; 'name',
              'format' =&gt; 'raw',
              'label' =&gt; 'Product name',
              'contentOptions' =&gt; function ($model, $key, $index, $column) {
                  return ['class' =&gt; 'tbl_name'];
              },
          ],
      ],
  ]); ?&gt;
  </code></pre>