如何生成具有自定义高度的文本字段(yii textField) [英] how to generate a textfield with customized height (yii textField)
问题描述
大家好,感谢您的阅读。
我有这个
<?php
echo $ form-> textField 'link',array(
'prepend'=>'< i class =icon-4x icon-globestyle =line-height:54px;>< / i& b $ b'class'=>'span12','maxlength'=> 999,
'height'=> 100,
'htmlOptions'=& ;'height:60px; font-size:22px;')
));
?>
这不适用于宽度,但是当我替换它的高度不工作。没有其他css规则覆盖它。
我如何在一个文本文件中设置自定义高度yii /www.yiiframework.com/doc/api/1.1/CActiveForm#textField-detail> yii docs :
public string textField(CModel $ model,string $ attribute,array $ htmlOptions = array())
因此您应该具有:
$ form-> textfield($ model,'link',array('style'=> ;'width:600px;'));
我看到你还有一个类:
$ form-> textfield($ model,'link',array('style'=>'width:600px;','class'=>'class_x' ));
现在,让我解释一下你的代码中会发生什么:
echo $ form-> textField($ model,'link',array(
'prepend'=>'< i class = 4x icon-globestyle =line-height:54px;>< / i>',
'class'=>'span12','maxlength'=> 999,
'height'=> 100,
'htmlOptions'=> array('style'=>'height:60px; font-size:22px;')
)
第一个和第二个参数都是ok
当它来到第三个,起初看起来不错,因为它是一个数组,它代表htmlOptions数组从文档
如果你深入挖掘,你看到在htmlOptions数组中有另一个htmlOptions数组; WHY?
写入:
echo $ form-> ; textField($ model,'link',array(
'prepend'=>'< i class =icon-4x icon-globestyle =line-height:54px;& / i>',
'class'=>'span12',
'style'=>'height:60px; font-size:22px; width:999px;',
));
Hello everybody and thanks for reading. I have this
<?php
echo $form->textField($model, 'link', array(
'prepend' => '<i class="icon-4x icon-globe" style="line-height: 54px;"></i>',
'class' => 'span12', 'maxlength' => 999,
'height'=>100,
'htmlOptions' => array('style' => 'height:60px;font-size: 22px;')
));
?>
This is not working for width but when i replace it with height its not working. There is no other css rules that overwrite it . How can i set a custom height on a textfiled in yii
from yii docs:
public string textField(CModel $model, string $attribute, array $htmlOptions=array ( ))
so you should have:
$form->textfield($model,'link',array('style'=>'width:600px;'));
i see that you also have a class:
$form->textfield($model,'link',array('style'=>'width:600px;', 'class' => 'class_x'));
now, let me explin what happens within your code:
echo $form->textField($model, 'link', array(
'prepend' => '<i class="icon-4x icon-globe" style="line-height: 54px;"></i>',
'class' => 'span12', 'maxlength' => 999,
'height'=>100,
'htmlOptions' => array('style' => 'height:60px;font-size: 22px;')
));
the first and second parameters are ok
when it comes to the 3rd one, at first it looks fine, because it is a array, that represents the htmlOptions array from the documentation
if you digg deeper, you see that in the htmlOptions array you have another htmlOptions array; WHY?
write like this:
echo $form->textField($model, 'link', array(
'prepend' => '<i class="icon-4x icon-globe" style="line-height: 54px;"></i>',
'class' => 'span12',
'style' => 'height:60px;font-size: 22px;width:999px;',
));
这篇关于如何生成具有自定义高度的文本字段(yii textField)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!