Yii 2.0 DetailView Set Width Demo Code
In Yii 2.0 DetailView, sometime too long content will break page width, this time need set max-width to limit line width to switch one line to more lines, the template part in the follow code is the limit width code
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'hp_id',
...
// content too long.
'hp_desc',
...
],
'template' => '<tr><th>{label}</th><td style="width:90%;">{value}</td></tr>',
]) ?>
Leave Comment