How to set width and height of textbox in cakephp?

In my application, I need to enter user data for a column named "body" in a table in a database.

My code in the .ctp file:

echo $form->input('body',array('style'=>'width: 900px'));

That way, I can specify the body field width, which works fine. But I also want to indicate the height.

I tried echo $form->input('body',array('style'=>'width: 900px height: 500px')); echo $form->input('body',array('style'=>'width: 900px','style'=>'height: 500px'));

The first does not work either in width or in height, and the second - only in height, but not in width. Can someone please tell me how to overcome this problem.

Thank you in advance.

+3
source share
1 answer
// in a css file.
.txtArea { width:900px; height:500px; }

// in your view
echo $form->input('body', array('class'=>'txtArea'));

will be the recommended and preferred way.

Also, make sure your inline CSS is correct:

echo $form->input('body', array('style'=>'width:900px; height:500px;'));

;, , , style , .

+7

All Articles