erand
(Erandbraho)
1
Hi All,
The default form looks a bit "ugly" when label is display: block;
I change it to display: inline; but input elements are not aligned vertically.
The only way I fix it is using table:
<table>
<tr><td>
<?php echo $form->labelEx($model,...); ?>
</td><td>
<?php echo $form->dropDownList($model,...); ?>
</td><td>
<?php echo $form->error($model,...); ?>
</td></tr>
...
But it is too long doing this for every form in the app.
Is there any simple way to do it?
Thank you in advance.
negar
(Nar8591)
2
hi
use of css with defult form yii :
label {
display: inline-block;
font-weight: 700;
margin-bottom: 5px;
}
div.form label {
font-family: tahoma;
font-size: 12px;
font-weight: normal;
width: 200px;
}
div.form input {
display: inline-block;
width: 300px;
}
.form-control {
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
color: #555;
display: block;
font-size: 14px;
height: 34px;
line-height: 1.42857;
padding: 6px 12px;
transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
width: 100%;
}
.form-control:focus {
border-color: #66afe9;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
outline: 0 none;
}
<div class="row">
<?php echo $form->labelEx($model, 'title'); ?>
<?php echo $form->textField($model, 'title', array('class' => 'form-control')); ?>
<?php echo $form->error($model, 'title'); ?>
</div>
erand
(Erandbraho)
3
Thank you n-r for your help 
I guess this is what I was looking for:
div.form label
{
...
...
display: inline-block;
width: 170px;
}
And your styling is also nice 
Thank you